Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2019-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#include <chainparams.h>6#include <consensus/consensus.h>7#include <core_io.h>8#include <policy/policy.h>9#include <script/script.h>10#include <test/fuzz/FuzzedDataProvider.h>11#include <test/fuzz/fuzz.h>12#include <test/fuzz/util.h>13#include <univalue.h>14#include <util/chaintype.h>16void initialize_script_format()17{18SelectParams(ChainType::REGTEST);19}21FUZZ_TARGET(script_format, .init = initialize_script_format)22{23FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());24const CScript script{ConsumeScript(fuzzed_data_provider)};25if (script.size() > MAX_STANDARD_TX_WEIGHT / WITNESS_SCALE_FACTOR) {26return;27}29(void)FormatScript(script);30(void)ScriptToAsmStr(script, /*fAttemptSighashDecode=*/fuzzed_data_provider.ConsumeBool());32UniValue o1(UniValue::VOBJ);33auto include_hex = fuzzed_data_provider.ConsumeBool();34auto include_address = fuzzed_data_provider.ConsumeBool();35ScriptToUniv(script, /*out=*/o1, include_hex, include_address);36}
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.