Skip to content

Commit

Permalink
fuzz: Directly place transactions in vector
Browse files Browse the repository at this point in the history
  • Loading branch information
instagibbs committed Nov 20, 2024
1 parent c041ad6 commit bedca1c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/test/fuzz/package_eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ FUZZ_TARGET(ephemeral_package_eval, .init = initialize_tx_pool)
bool last_tx = num_txs > 1 && txs.size() == num_txs - 1;

// Create transaction to add to the mempool
const CTransactionRef tx = [&] {
txs.emplace_back([&] {
CMutableTransaction tx_mut;
tx_mut.version = CTransaction::CURRENT_VERSION;
tx_mut.nLockTime = 0;
Expand Down Expand Up @@ -299,8 +299,7 @@ FUZZ_TARGET(ephemeral_package_eval, .init = initialize_tx_pool)
outpoints_value[COutPoint(tx->GetHash(), i)] = tx->vout[i].nValue;
}
return tx;
}();
txs.push_back(tx);
}());
}

if (fuzzed_data_provider.ConsumeBool()) {
Expand Down Expand Up @@ -392,7 +391,7 @@ FUZZ_TARGET(tx_package_eval, .init = initialize_tx_pool)
bool last_tx = num_txs > 1 && txs.size() == num_txs - 1;

// Create transaction to add to the mempool
const CTransactionRef tx = [&] {
txs.emplace_back([&] {
CMutableTransaction tx_mut;
tx_mut.version = fuzzed_data_provider.ConsumeBool() ? TRUC_VERSION : CTransaction::CURRENT_VERSION;
tx_mut.nLockTime = fuzzed_data_provider.ConsumeBool() ? 0 : fuzzed_data_provider.ConsumeIntegral<uint32_t>();
Expand Down Expand Up @@ -470,8 +469,7 @@ FUZZ_TARGET(tx_package_eval, .init = initialize_tx_pool)
outpoints_value[COutPoint(tx->GetHash(), i)] = tx->vout[i].nValue;
}
return tx;
}();
txs.push_back(tx);
}());
}

if (fuzzed_data_provider.ConsumeBool()) {
Expand Down

0 comments on commit bedca1c

Please sign in to comment.