From bedca1cb6633f4b9a5f8f532f27e084f23f04a2e Mon Sep 17 00:00:00 2001 From: Greg Sanders Date: Tue, 12 Nov 2024 12:47:56 -0500 Subject: [PATCH] fuzz: Directly place transactions in vector --- src/test/fuzz/package_eval.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/test/fuzz/package_eval.cpp b/src/test/fuzz/package_eval.cpp index f3c5b0ab44646..88eea3bf909fd 100644 --- a/src/test/fuzz/package_eval.cpp +++ b/src/test/fuzz/package_eval.cpp @@ -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; @@ -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()) { @@ -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(); @@ -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()) {