44 const std::optional<CScript> script_opt = ConsumeDeserializable<CScript>(fuzzed_data_provider);
45 if (!script_opt)
return;
46 const CScript script{*script_opt};
50 const unsigned int size = compressed[0];
56 assert(script == decompressed_script);
60 bool is_standard_ret =
IsStandard(script, which_type);
61 if (!is_standard_ret) {
70 assert(script.IsUnspendable());
72 if (script.IsUnspendable()) {
79 if (!extract_destination_ret) {
88 assert(!extract_destination_ret);
98 std::vector<std::vector<unsigned char>> solutions;
99 (void)
Solver(script, solutions);
101 (void)script.HasValidOps();
102 (void)script.IsPayToScriptHash();
103 (void)script.IsPayToWitnessScriptHash();
104 (void)script.IsPushOnly();
105 (void)script.GetSigOpCount(
false);
121 compressed_script.
assign(bytes.begin(), bytes.end());
123 if (compressed_script.
size() >= 32) {
129 const std::optional<CScript> other_script = ConsumeDeserializable<CScript>(fuzzed_data_provider);
140 for (
const auto& s : random_string_vector) {
141 wit.
stack.emplace_back(s.begin(), s.end());
172 Assert(dest.empty() != valid);
176 (void)(tx_destination_1 < tx_destination_2);
177 if (tx_destination_1 == tx_destination_2) {
void SelectParams(const std::string &network)
Sets the params returned by Params() to those for the given chain name.
#define Assert(val)
Identity function.
static const std::string REGTEST
Serialized script, used inside transaction inputs and outputs.
Users of this module must hold an ECCVerifyHandle.
std::string ConsumeRandomLengthString(size_t max_length)
T ConsumeIntegralInRange(T min, T max)
Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without h...
iterator erase(iterator pos)
void assign(size_type n, const T &val)
bool DecompressScript(CScript &script, unsigned int nSize, const CompressedScript &in)
bool CompressScript(const CScript &script, CompressedScript &out)
std::string FormatScript(const CScript &script)
std::string ScriptToAsmStr(const CScript &script, const bool fAttemptSighashDecode=false)
Create the assembly string representation of a CScript object.
void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, bool include_hex, bool include_address=true)
void ScriptToUniv(const CScript &script, UniValue &out)
static size_t RecursiveDynamicUsage(const CScript &script)
std::unique_ptr< Descriptor > InferDescriptor(const CScript &script, const SigningProvider &provider)
Find a descriptor for the specified script, using information from provider where possible.
int FindAndDelete(CScript &script, const CScript &b)
size_t CountWitnessSigOps(const CScript &scriptSig, const CScript &scriptPubKey, const CScriptWitness *witness, unsigned int flags)
bool IsValidDestinationString(const std::string &str, const CChainParams ¶ms)
std::string EncodeDestination(const CTxDestination &dest)
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg)
bool IsStandard(const CScript &scriptPubKey, TxoutType &whichType)
UniValue DescribeAddress(const CTxDestination &dest)
std::string GetOpName(opcodetype opcode)
std::string ScriptErrorString(const ScriptError serror)
enum ScriptError_t ScriptError
bool IsSegWitOutput(const SigningProvider &provider, const CScript &script)
Check whether a scriptPubKey is known to be segwit.
bool IsSolvable(const SigningProvider &provider, const CScript &script)
CKeyID GetKeyForDestination(const SigningProvider &store, const CTxDestination &dest)
Return the CKeyID of the key involved in a script (if there is a unique one).
TxoutType Solver(const CScript &scriptPubKey, std::vector< std::vector< unsigned char > > &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
@ NULL_DATA
unspendable OP_RETURN script that carries data
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
std::vector< std::vector< unsigned char > > stack
FUZZ_TARGET_INIT(script, initialize_script)
CTxDestination ConsumeTxDestination(FuzzedDataProvider &fuzzed_data_provider) noexcept
std::vector< std::string > ConsumeRandomLengthStringVector(FuzzedDataProvider &fuzzed_data_provider, const size_t max_vector_size=16, const size_t max_string_length=16) noexcept
opcodetype ConsumeOpcodeType(FuzzedDataProvider &fuzzed_data_provider) noexcept
std::vector< uint8_t > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept