52    for (
int i = 0; i < num_in; ++i) {
 
   53        const auto& txid_prev = prevout_txids ?
 
   71        tx_mut.
vin.push_back(in);
 
   73    for (
int i = 0; i < num_out; ++i) {
 
   75        const auto script_pk = p2wsh_op_true ?
 
   78        tx_mut.
vout.emplace_back(amount, script_pk);
 
   87    for (
size_t i = 0; i < n_elements; ++i) {
 
   99        static constexpr unsigned MAX_BUFFER_SZ{128};
 
  100        std::vector<uint8_t> buffer(MAX_BUFFER_SZ, uint8_t{
'a'});
 
  121                            pubkey_bytes.back() = num_data; 
 
  123                        r_script << pubkey_bytes;
 
  130                    std::copy(vec.begin(), vec.end(), buffer.begin());
 
  168    std::map<COutPoint, Coin> coins;
 
  170        const std::optional<COutPoint> outpoint{ConsumeDeserializable<COutPoint>(
fuzzed_data_provider)};
 
  178        coins[*outpoint] = *coin;
 
  221            if (program.size() < 2) {
 
  226    Assert(call_size == std::variant_size_v<CTxDestination>);
 
  227    return tx_destination;
 
  236    key.
Set(key_data.begin(), key_data.end(), compressed_value);
 
  242    for (
const CTxIn& tx_in : tx.vin) {
 
  243        const Coin& coin = inputs.AccessCoin(tx_in.
prevout);
 
  278#if defined _GNU_SOURCE && (defined(__linux__) || defined(__FreeBSD__)) 
  279    const cookie_io_functions_t io_hooks = {
 
  285    return fopencookie(
this, mode.c_str(), io_hooks);
 
  300    if (random_bytes.empty()) {
 
  303    std::memcpy(buf, random_bytes.data(), random_bytes.size());
 
  307    fuzzed_file->
m_offset += random_bytes.size();
 
  308    return random_bytes.size();
 
  325    assert(whence == SEEK_SET || whence == SEEK_CUR || whence == SEEK_END);
 
  328    int64_t new_offset = 0;
 
  329    if (whence == SEEK_SET) {
 
  330        new_offset = *offset;
 
  331    } 
else if (whence == SEEK_CUR) {
 
  335        new_offset = fuzzed_file->
m_offset + *offset;
 
  336    } 
else if (whence == SEEK_END) {
 
  341        new_offset = n + *offset;
 
  343    if (new_offset < 0) {
 
  347    *offset = new_offset;
 
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, PayToAnchor, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
 
static constexpr CAmount MAX_MONEY
No amount larger than this (in satoshi) is valid.
 
int64_t CAmount
Amount in satoshis (Can be negative)
 
static constexpr CAmount COIN
The amount of satoshis in one BTC.
 
#define Assert(val)
Identity function.
 
CCoinsView that adds a memory cache for transactions to another CCoinsView.
 
An encapsulated private key.
 
void Set(const T pbegin, const T pend, bool fCompressedIn)
Initialize using begin and end iterators to byte data.
 
An outpoint - a combination of a transaction hash and an index n into its vout.
 
An encapsulated public key.
 
static constexpr unsigned int COMPRESSED_SIZE
 
static constexpr unsigned int SIZE
secp256k1:
 
A hasher class for SHA-256.
 
void Finalize(unsigned char hash[OUTPUT_SIZE])
 
CSHA256 & Write(const unsigned char *data, size_t len)
 
Serialized script, used inside transaction inputs and outputs.
 
The basic transaction that is broadcasted on the network and contained in blocks.
 
static const uint32_t CURRENT_VERSION
 
An input of a transaction.
 
static const uint32_t MAX_SEQUENCE_NONFINAL
This is the maximum sequence number that enables both nLockTime and OP_CHECKLOCKTIMEVERIFY (BIP 65).
 
static const uint32_t SEQUENCE_FINAL
Setting nSequence to this value for every input in a transaction disables nLockTime/IsFinalTx().
 
CScriptWitness scriptWitness
Only serialized through CTransaction.
 
bool IsSpent() const
Either this coin never existed (see e.g.
 
std::vector< T > ConsumeBytes(size_t num_bytes)
 
T ConsumeIntegralInRange(T min, T max)
 
T PickValueInArray(const T(&array)[size])
 
static ssize_t write(void *cookie, const char *buf, size_t size)
 
FuzzedDataProvider & m_fuzzed_data_provider
 
static int seek(void *cookie, int64_t *offset, int whence)
 
static int close(void *cookie)
 
static ssize_t read(void *cookie, char *buf, size_t size)
 
constexpr unsigned char * begin()
 
static transaction_identifier FromUint256(const uint256 &id)
 
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
 
bool AdditionOverflow(const T i, const T j) noexcept
 
std::vector< unsigned char > ToByteVector(const T &in)
 
A mutable version of CTransaction.
 
std::vector< CTxOut > vout
 
std::vector< std::vector< unsigned char > > stack
 
CTxDestination subtype to encode any future Witness version.
 
uint32_t ConsumeSequence(FuzzedDataProvider &fuzzed_data_provider) noexcept
 
CScript ConsumeScript(FuzzedDataProvider &fuzzed_data_provider, const bool maybe_p2wsh) noexcept
 
int64_t ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) 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
 
bool ContainsSpentInput(const CTransaction &tx, const CCoinsViewCache &inputs) noexcept
 
CScriptWitness ConsumeScriptWitness(FuzzedDataProvider &fuzzed_data_provider, const size_t max_stack_elem_size) noexcept
 
std::vector< uint8_t > ConstructPubKeyBytes(FuzzedDataProvider &fuzzed_data_provider, std::span< const uint8_t > byte_data, const bool compressed) noexcept
 
CKey ConsumePrivateKey(FuzzedDataProvider &fuzzed_data_provider, std::optional< bool > compressed) noexcept
 
CTxDestination ConsumeTxDestination(FuzzedDataProvider &fuzzed_data_provider) noexcept
 
CAmount ConsumeMoney(FuzzedDataProvider &fuzzed_data_provider, const std::optional< CAmount > &max) noexcept
 
std::map< COutPoint, Coin > ConsumeCoins(FuzzedDataProvider &fuzzed_data_provider) noexcept
 
CScriptNum ConsumeScriptNum(FuzzedDataProvider &fuzzed_data_provider) noexcept
 
auto & PickValue(FuzzedDataProvider &fuzzed_data_provider, Collection &col)
 
std::vector< B > ConsumeFixedLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const size_t length) noexcept
Returns a byte vector of specified size regardless of the number of remaining bytes available from th...
 
uint256 ConsumeUInt256(FuzzedDataProvider &fuzzed_data_provider) noexcept
 
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
 
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
 
opcodetype ConsumeOpcodeType(FuzzedDataProvider &fuzzed_data_provider) noexcept
 
void SetFuzzedErrNo(FuzzedDataProvider &fuzzed_data_provider, const std::array< T, size > &errnos)
Sets errno to a value selected from the given std::array errnos.
 
uint160 ConsumeUInt160(FuzzedDataProvider &fuzzed_data_provider) noexcept
 
static const std::vector< uint8_t > WITNESS_STACK_ELEM_OP_TRUE
 
static const CScript P2WSH_OP_TRUE
 
static constexpr uint32_t MAX_BIP125_RBF_SEQUENCE
 
std::optional< int64_t > ParseISO8601DateTime(std::string_view str)
 
FuzzedDataProvider & fuzzed_data_provider