Bitcoin Core 28.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>
7#include <core_io.h>
8#include <policy/policy.h>
9#include <script/script.h>
11#include <test/fuzz/fuzz.h>
12#include <test/fuzz/util.h>
13#include <univalue.h>
14#include <util/chaintype.h>
15
17{
19}
20
22{
23 FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
24 const CScript script{ConsumeScript(fuzzed_data_provider)};
26 return;
27 }
28
29 (void)FormatScript(script);
30 (void)ScriptToAsmStr(script, /*fAttemptSighashDecode=*/fuzzed_data_provider.ConsumeBool());
31
33 auto include_hex = fuzzed_data_provider.ConsumeBool();
34 auto include_address = fuzzed_data_provider.ConsumeBool();
35 ScriptToUniv(script, /*out=*/o1, include_hex, include_address);
36}
void SelectParams(const ChainType chain)
Sets the params returned by Params() to those for the given chain type.
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:415
@ VOBJ
Definition: univalue.h:24
static const int WITNESS_SCALE_FACTOR
Definition: consensus.h:21
std::string FormatScript(const CScript &script)
Definition: core_write.cpp:39
std::string ScriptToAsmStr(const CScript &script, const bool fAttemptSighashDecode=false)
Create the assembly string representation of a CScript object.
Definition: core_write.cpp:98
void ScriptToUniv(const CScript &script, UniValue &out, bool include_hex=true, bool include_address=false, const SigningProvider *provider=nullptr)
Definition: core_write.cpp:150
static constexpr int32_t MAX_STANDARD_TX_WEIGHT
The maximum weight for transactions we're willing to relay/mine.
Definition: policy.h:27
FUZZ_TARGET(script_format,.init=initialize_script_format)
void initialize_script_format()
CScript ConsumeScript(FuzzedDataProvider &fuzzed_data_provider, const bool maybe_p2wsh) noexcept
Definition: util.cpp:93