Revert "refactor: Simplify extra_txn to be a vec of CTransactionRef instead of a vec of pair<Wtxid, CTransactionRef>"

This reverts commit a8203e9412.
This commit is contained in:
Anthony Towns
2025-08-25 15:58:59 +10:00
parent df5a50e5de
commit b9300d8d0a
6 changed files with 24 additions and 19 deletions

View File

@@ -14,7 +14,7 @@
#include <boost/test/unit_test.hpp>
const std::vector<CTransactionRef> empty_extra_txn;
const std::vector<std::pair<Wtxid, CTransactionRef>> empty_extra_txn;
BOOST_FIXTURE_TEST_SUITE(blockencodings_tests, RegTestingSetup)
@@ -318,7 +318,7 @@ BOOST_AUTO_TEST_CASE(ReceiveWithExtraTransactions) {
const CTransactionRef non_block_tx = MakeTransactionRef(std::move(mtx));
CBlock block(BuildBlockTestCase(rand_ctx));
std::vector<CTransactionRef> extra_txn;
std::vector<std::pair<Wtxid, CTransactionRef>> extra_txn;
extra_txn.resize(10);
LOCK2(cs_main, pool.cs);
@@ -342,9 +342,9 @@ BOOST_AUTO_TEST_CASE(ReceiveWithExtraTransactions) {
BOOST_CHECK( partial_block.IsTxAvailable(2));
// Add an unrelated tx to extra_txn:
extra_txn[0] = non_block_tx;
extra_txn[0] = {non_block_tx->GetWitnessHash(), non_block_tx};
// and a tx from the block that's not in the mempool:
extra_txn[1] = block.vtx[1];
extra_txn[1] = {block.vtx[1]->GetWitnessHash(), block.vtx[1]};
BOOST_CHECK(partial_block_with_extra.InitData(cmpctblock, extra_txn) == READ_STATUS_OK);
BOOST_CHECK(partial_block_with_extra.IsTxAvailable(0));

View File

@@ -67,7 +67,7 @@ FUZZ_TARGET(partially_downloaded_block, .init = initialize_pdb)
// The coinbase is always available
available.insert(0);
std::vector<CTransactionRef> extra_txn;
std::vector<std::pair<Wtxid, CTransactionRef>> extra_txn;
for (size_t i = 1; i < block->vtx.size(); ++i) {
auto tx{block->vtx[i]};
@@ -75,7 +75,7 @@ FUZZ_TARGET(partially_downloaded_block, .init = initialize_pdb)
bool add_to_mempool{fuzzed_data_provider.ConsumeBool()};
if (add_to_extra_txn) {
extra_txn.emplace_back(tx);
extra_txn.emplace_back(tx->GetWitnessHash(), tx);
available.insert(i);
}