17bool CastToBool(
const std::vector<unsigned char>& vch);
24 const std::optional<CMutableTransaction> mtx = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider,
TX_WITH_WITNESS);
27 const unsigned int in = fuzzed_data_provider.
ConsumeIntegral<
unsigned int>();
28 if (in < tx_to.vin.size()) {
32 (void)
SignatureHash(script_code, tx_to, in, n_hash_type, amount, sigversion,
nullptr);
33 const std::optional<CMutableTransaction> mtx_precomputed = ConsumeDeserializable<CMutableTransaction>(fuzzed_data_provider,
TX_WITH_WITNESS);
34 if (mtx_precomputed) {
40 (void)
SignatureHash(script_code, tx_to, in, n_hash_type, amount, sigversion, &precomputed_transaction_data);
58 if (tx.vin.empty())
return;
66 for (
int i{0}; i < 100; ++i) {
68 const auto nocache_res{
SignatureHash(scriptcode, tx, in_index, hash_type, amount, sigversion)};
69 const auto cache_res{
SignatureHash(scriptcode, tx, in_index, hash_type, amount, sigversion,
nullptr, &sighash_cache)};
70 Assert(nocache_res == cache_res);
#define Assert(val)
Identity function.
Serialized script, used inside transaction inputs and outputs.
The basic transaction that is broadcasted on the network and contained in blocks.
T ConsumeIntegralInRange(T min, T max)
T PickValueInArray(const T(&array)[size])
Data structure to cache SHA256 midstates for the ECDSA sighash calculations (bare,...
uint256 SignatureHash(const CScript &scriptCode, const T &txTo, unsigned int nIn, int32_t nHashType, const CAmount &amount, SigVersion sigversion, const PrecomputedTransactionData *cache, SigHashCache *sighash_cache)
@ BASE
Bare scripts and BIP16 P2SH-wrapped redeemscripts.
@ WITNESS_V0
Witness v0 (P2WPKH and P2WSH); see BIP 141.
static constexpr TransactionSerParams TX_WITH_WITNESS
FUZZ_TARGET(script_interpreter)
bool CastToBool(const std::vector< unsigned char > &vch)
CScript ConsumeScript(FuzzedDataProvider &fuzzed_data_provider, const bool maybe_p2wsh) noexcept
CMutableTransaction ConsumeTransaction(FuzzedDataProvider &fuzzed_data_provider, const std::optional< std::vector< Txid > > &prevout_txids, const int max_num_in, const int max_num_out) noexcept
CAmount ConsumeMoney(FuzzedDataProvider &fuzzed_data_provider, const std::optional< CAmount > &max) noexcept
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept