Skip to content

Commit bedca1c

Browse files
committed
fuzz: Directly place transactions in vector
1 parent c041ad6 commit bedca1c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/test/fuzz/package_eval.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ FUZZ_TARGET(ephemeral_package_eval, .init = initialize_tx_pool)
232232
bool last_tx = num_txs > 1 && txs.size() == num_txs - 1;
233233

234234
// Create transaction to add to the mempool
235-
const CTransactionRef tx = [&] {
235+
txs.emplace_back([&] {
236236
CMutableTransaction tx_mut;
237237
tx_mut.version = CTransaction::CURRENT_VERSION;
238238
tx_mut.nLockTime = 0;
@@ -299,8 +299,7 @@ FUZZ_TARGET(ephemeral_package_eval, .init = initialize_tx_pool)
299299
outpoints_value[COutPoint(tx->GetHash(), i)] = tx->vout[i].nValue;
300300
}
301301
return tx;
302-
}();
303-
txs.push_back(tx);
302+
}());
304303
}
305304

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

394393
// Create transaction to add to the mempool
395-
const CTransactionRef tx = [&] {
394+
txs.emplace_back([&] {
396395
CMutableTransaction tx_mut;
397396
tx_mut.version = fuzzed_data_provider.ConsumeBool() ? TRUC_VERSION : CTransaction::CURRENT_VERSION;
398397
tx_mut.nLockTime = fuzzed_data_provider.ConsumeBool() ? 0 : fuzzed_data_provider.ConsumeIntegral<uint32_t>();
@@ -470,8 +469,7 @@ FUZZ_TARGET(tx_package_eval, .init = initialize_tx_pool)
470469
outpoints_value[COutPoint(tx->GetHash(), i)] = tx->vout[i].nValue;
471470
}
472471
return tx;
473-
}();
474-
txs.push_back(tx);
472+
}());
475473
}
476474

477475
if (fuzzed_data_provider.ConsumeBool()) {

0 commit comments

Comments
 (0)