Skip to content

Commit dbc5bdb

Browse files
glozowTheCharlatan
authored andcommitted
[refactor] remove access to mapTx.find in mempool_tests.cpp
1 parent f80909e commit dbc5bdb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/test/mempool_tests.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
191191
CheckSort<descendant_score>(pool, sortedOrder);
192192

193193
CTxMemPool::setEntries setAncestors;
194-
setAncestors.insert(pool.mapTx.find(tx6.GetHash()));
194+
setAncestors.insert(pool.GetIter(tx6.GetHash()).value());
195195
CMutableTransaction tx7 = CMutableTransaction();
196196
tx7.vin.resize(1);
197197
tx7.vin[0].prevout = COutPoint(tx6.GetHash(), 0);
@@ -223,7 +223,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
223223
tx8.vout.resize(1);
224224
tx8.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
225225
tx8.vout[0].nValue = 10 * COIN;
226-
setAncestors.insert(pool.mapTx.find(tx7.GetHash()));
226+
setAncestors.insert(pool.GetIter(tx7.GetHash()).value());
227227
pool.addUnchecked(entry.Fee(0LL).Time(NodeSeconds{2s}).FromTx(tx8), setAncestors);
228228

229229
// Now tx8 should be sorted low, but tx6/tx both high
@@ -247,8 +247,8 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
247247

248248
std::vector<std::string> snapshotOrder = sortedOrder;
249249

250-
setAncestors.insert(pool.mapTx.find(tx8.GetHash()));
251-
setAncestors.insert(pool.mapTx.find(tx9.GetHash()));
250+
setAncestors.insert(pool.GetIter(tx8.GetHash()).value());
251+
setAncestors.insert(pool.GetIter(tx9.GetHash()).value());
252252
/* tx10 depends on tx8 and tx9 and has a high fee*/
253253
CMutableTransaction tx10 = CMutableTransaction();
254254
tx10.vin.resize(2);
@@ -291,11 +291,11 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
291291
BOOST_CHECK_EQUAL(pool.size(), 10U);
292292

293293
// Now try removing tx10 and verify the sort order returns to normal
294-
pool.removeRecursive(pool.mapTx.find(tx10.GetHash())->GetTx(), REMOVAL_REASON_DUMMY);
294+
pool.removeRecursive(*Assert(pool.get(tx10.GetHash())), REMOVAL_REASON_DUMMY);
295295
CheckSort<descendant_score>(pool, snapshotOrder);
296296

297-
pool.removeRecursive(pool.mapTx.find(tx9.GetHash())->GetTx(), REMOVAL_REASON_DUMMY);
298-
pool.removeRecursive(pool.mapTx.find(tx8.GetHash())->GetTx(), REMOVAL_REASON_DUMMY);
297+
pool.removeRecursive(*Assert(pool.get(tx9.GetHash())), REMOVAL_REASON_DUMMY);
298+
pool.removeRecursive(*Assert(pool.get(tx8.GetHash())), REMOVAL_REASON_DUMMY);
299299
}
300300

301301
BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)

0 commit comments

Comments
 (0)