17 bool CastToBool(
const std::vector<unsigned char>& vch);
28 if (in < tx_to.vin.size()) {
32 (void)
SignatureHash(script_code, tx_to, in, n_hash_type, amount, sigversion,
nullptr);
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;
59 const auto in_index{provider.ConsumeIntegralInRange<uint32_t>(0, tx.vin.size() - 1)};
61 const auto sigversion{(
SigVersion)provider.ConsumeIntegralInRange(0, 1)};
66 for (
int i{0}; i < 100; ++i) {
67 const auto hash_type{((i & 2) == 0) ? provider.ConsumeIntegral<int8_t>() : provider.ConsumeIntegral<int32_t>()};
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);
Witness v0 (P2WPKH and P2WSH); see BIP 141.
bool CastToBool(const std::vector< unsigned char > &vch)
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)
CScript ConsumeScript(FuzzedDataProvider &fuzzed_data_provider, const bool maybe_p2wsh) noexcept
Bare scripts and BIP16 P2SH-wrapped redeemscripts.
Data structure to cache SHA256 midstates for the ECDSA sighash calculations (bare, P2SH, P2WPKH, P2WSH).
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
FUZZ_TARGET(script_interpreter)
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
Serialized script, used inside transaction inputs and outputs.
FuzzedDataProvider & fuzzed_data_provider
CAmount ConsumeMoney(FuzzedDataProvider &fuzzed_data_provider, const std::optional< CAmount > &max) noexcept
The basic transaction that is broadcasted on the network and contained in blocks. ...
T PickValueInArray(const T(&array)[size])
#define Assert(val)
Identity function.
static constexpr TransactionSerParams TX_WITH_WITNESS