aboutsummaryrefslogtreecommitdiff
path: root/src/test/mempool_tests.cpp
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2023-08-30 15:48:51 +0100
committerTheCharlatan <seb.kung@gmail.com>2023-11-10 16:44:35 +0100
commitdbc5bdbf595e9dd0330493645ebff0b8696192a3 (patch)
treefcb7ba5f125399b839b30f0356d2bdacdcec52d9 /src/test/mempool_tests.cpp
parentf80909e7a31523d8f197fd650b138b9f228cd13f (diff)
downloadbitcoin-dbc5bdbf595e9dd0330493645ebff0b8696192a3.tar.xz
[refactor] remove access to mapTx.find in mempool_tests.cpp
Diffstat (limited to 'src/test/mempool_tests.cpp')
-rw-r--r--src/test/mempool_tests.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/test/mempool_tests.cpp b/src/test/mempool_tests.cpp
index db58a0baec..217e4a6d22 100644
--- a/src/test/mempool_tests.cpp
+++ b/src/test/mempool_tests.cpp
@@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
CheckSort<descendant_score>(pool, sortedOrder);
CTxMemPool::setEntries setAncestors;
- setAncestors.insert(pool.mapTx.find(tx6.GetHash()));
+ setAncestors.insert(pool.GetIter(tx6.GetHash()).value());
CMutableTransaction tx7 = CMutableTransaction();
tx7.vin.resize(1);
tx7.vin[0].prevout = COutPoint(tx6.GetHash(), 0);
@@ -223,7 +223,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
tx8.vout.resize(1);
tx8.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx8.vout[0].nValue = 10 * COIN;
- setAncestors.insert(pool.mapTx.find(tx7.GetHash()));
+ setAncestors.insert(pool.GetIter(tx7.GetHash()).value());
pool.addUnchecked(entry.Fee(0LL).Time(NodeSeconds{2s}).FromTx(tx8), setAncestors);
// Now tx8 should be sorted low, but tx6/tx both high
@@ -247,8 +247,8 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
std::vector<std::string> snapshotOrder = sortedOrder;
- setAncestors.insert(pool.mapTx.find(tx8.GetHash()));
- setAncestors.insert(pool.mapTx.find(tx9.GetHash()));
+ setAncestors.insert(pool.GetIter(tx8.GetHash()).value());
+ setAncestors.insert(pool.GetIter(tx9.GetHash()).value());
/* tx10 depends on tx8 and tx9 and has a high fee*/
CMutableTransaction tx10 = CMutableTransaction();
tx10.vin.resize(2);
@@ -291,11 +291,11 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
BOOST_CHECK_EQUAL(pool.size(), 10U);
// Now try removing tx10 and verify the sort order returns to normal
- pool.removeRecursive(pool.mapTx.find(tx10.GetHash())->GetTx(), REMOVAL_REASON_DUMMY);
+ pool.removeRecursive(*Assert(pool.get(tx10.GetHash())), REMOVAL_REASON_DUMMY);
CheckSort<descendant_score>(pool, snapshotOrder);
- pool.removeRecursive(pool.mapTx.find(tx9.GetHash())->GetTx(), REMOVAL_REASON_DUMMY);
- pool.removeRecursive(pool.mapTx.find(tx8.GetHash())->GetTx(), REMOVAL_REASON_DUMMY);
+ pool.removeRecursive(*Assert(pool.get(tx9.GetHash())), REMOVAL_REASON_DUMMY);
+ pool.removeRecursive(*Assert(pool.get(tx8.GetHash())), REMOVAL_REASON_DUMMY);
}
BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)