Bitcoin Core  22.99.0
P2P Digital Currency
script_format.cpp
Go to the documentation of this file.
1 // Copyright (c) 2019-2022 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <chainparams.h>
6 #include <core_io.h>
7 #include <script/script.h>
9 #include <test/fuzz/fuzz.h>
10 #include <test/fuzz/util.h>
11 #include <univalue.h>
12 
14 {
16 }
17 
19 {
20  FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
21  const CScript script{ConsumeScript(fuzzed_data_provider)};
22 
23  (void)FormatScript(script);
24  (void)ScriptToAsmStr(script, /*fAttemptSighashDecode=*/fuzzed_data_provider.ConsumeBool());
25 
27  ScriptPubKeyToUniv(script, o1, /*include_hex=*/fuzzed_data_provider.ConsumeBool());
29  ScriptToUniv(script, o3);
30 }
UniValue::VOBJ
@ VOBJ
Definition: univalue.h:19
initialize_script_format
void initialize_script_format()
Definition: script_format.cpp:13
ScriptPubKeyToUniv
void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, bool include_hex, bool include_address=true)
Definition: core_write.cpp:151
ScriptToUniv
void ScriptToUniv(const CScript &script, UniValue &out)
Definition: core_write.cpp:146
ConsumeScript
CScript ConsumeScript(FuzzedDataProvider &fuzzed_data_provider, const bool maybe_p2wsh) noexcept
Definition: util.cpp:340
util.h
FormatScript
std::string FormatScript(const CScript &script)
Definition: core_write.cpp:35
chainparams.h
core_io.h
UniValue
Definition: univalue.h:17
univalue.h
CBaseChainParams::REGTEST
static const std::string REGTEST
Definition: chainparamsbase.h:25
FuzzedDataProvider.h
SelectParams
void SelectParams(const std::string &network)
Sets the params returned by Params() to those for the given chain name.
Definition: chainparams.cpp:580
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:405
script.h
FUZZ_TARGET_INIT
FUZZ_TARGET_INIT(script_format, initialize_script_format)
Definition: script_format.cpp:18
fuzz.h
FuzzedDataProvider
Definition: FuzzedDataProvider.h:31
FuzzedDataProvider::ConsumeBool
bool ConsumeBool()
Definition: FuzzedDataProvider.h:288
ScriptToAsmStr
std::string ScriptToAsmStr(const CScript &script, const bool fAttemptSighashDecode=false)
Create the assembly string representation of a CScript object.
Definition: core_write.cpp:94