5 #include <chainparams.h>
45 const unsigned int size = compressed[0];
51 assert(script == decompressed_script);
55 bool is_standard_ret =
IsStandard(script, std::nullopt, which_type);
56 if (!is_standard_ret) {
65 assert(script.IsUnspendable());
67 if (script.IsUnspendable()) {
74 if (!extract_destination_ret) {
83 assert(!extract_destination_ret);
92 std::vector<std::vector<unsigned char>> solutions;
93 (void)
Solver(script, solutions);
95 (void)script.HasValidOps();
96 (void)script.IsPayToScriptHash();
97 (void)script.IsPayToWitnessScriptHash();
98 (void)script.IsPushOnly();
99 (void)script.GetSigOpCount(
false);
104 compressed_script.
assign(bytes.begin(), bytes.end());
106 if (compressed_script.
size() >= 32) {
112 const std::optional<CScript> other_script = ConsumeDeserializable<CScript>(fuzzed_data_provider);
123 for (
const auto& s : random_string_vector) {
124 wit.
stack.emplace_back(s.begin(), s.end());
155 Assert(dest.empty() != valid);
159 (void)(tx_destination_1 < tx_destination_2);
160 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.
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)
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)
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg, std::vector< int > *error_locations)
std::string EncodeDestination(const CTxDestination &dest)
bool IsStandard(const CScript &scriptPubKey, const std::optional< unsigned > &max_datacarrier_bytes, 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.
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)
CScript ConsumeScript(FuzzedDataProvider &fuzzed_data_provider, const bool maybe_p2wsh) noexcept
CTxDestination ConsumeTxDestination(FuzzedDataProvider &fuzzed_data_provider) noexcept
std::vector< uint8_t > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) 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