5#include <chainparams.h>
46 const unsigned int size = compressed[0];
57 if (!is_standard_ret) {
68 if (
script.IsUnspendable()) {
75 if (!extract_destination_ret) {
84 assert(!extract_destination_ret);
93 std::vector<std::vector<unsigned char>> solutions;
96 (void)
script.HasValidOps();
97 (void)
script.IsPayToAnchor();
98 (void)
script.IsPayToScriptHash();
99 (void)
script.IsPayToWitnessScriptHash();
100 (void)
script.IsPushOnly();
101 (void)
script.GetSigOpCount(
false);
106 compressed_script.
assign(bytes.begin(), bytes.end());
108 if (compressed_script.
size() >= 32) {
114 const std::optional<CScript> other_script = ConsumeDeserializable<CScript>(fuzzed_data_provider);
125 for (
const auto&
s : random_string_vector) {
126 wit.
stack.emplace_back(
s.begin(),
s.end());
157 if (!std::get_if<PubKeyDestination>(&tx_destination_1)) {
159 Assert(dest.empty() != valid);
164 (void)(tx_destination_1 < tx_destination_2);
165 if (tx_destination_1 == tx_destination_2) {
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a scriptPubKey for the destination.
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination corresponds to one with an address.
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, PayToAnchor, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
void SelectParams(const ChainType chain)
Sets the params returned by Params() to those for the given chain type.
#define Assert(val)
Identity function.
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)
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::unique_ptr< Descriptor > InferDescriptor(const CScript &script, const SigningProvider &provider)
Find a descriptor for the specified script, using information from provider where possible.
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.
@ NULL_DATA
unspendable OP_RETURN script that carries data
std::vector< std::vector< unsigned char > > stack
FUZZ_TARGET(script,.init=initialize_script)
CScript ConsumeScript(FuzzedDataProvider &fuzzed_data_provider, const bool maybe_p2wsh) noexcept
CTxDestination ConsumeTxDestination(FuzzedDataProvider &fuzzed_data_provider) noexcept
std::vector< B > 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