14
14
15
15
BOOST_FIXTURE_TEST_SUITE (mempool_tests, TestingSetup)
16
16
17
+ static constexpr auto REMOVAL_REASON_DUMMY = MemPoolRemovalReason::REPLACED;
18
+
17
19
BOOST_AUTO_TEST_CASE (MempoolRemoveTest)
18
20
{
19
21
// Test CTxMemPool::remove functionality
@@ -59,13 +61,13 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
59
61
60
62
// Nothing in pool, remove should do nothing:
61
63
unsigned int poolSize = testPool.size ();
62
- testPool.removeRecursive (CTransaction (txParent));
64
+ testPool.removeRecursive (CTransaction (txParent), REMOVAL_REASON_DUMMY );
63
65
BOOST_CHECK_EQUAL (testPool.size (), poolSize);
64
66
65
67
// Just the parent:
66
68
testPool.addUnchecked (entry.FromTx (txParent));
67
69
poolSize = testPool.size ();
68
- testPool.removeRecursive (CTransaction (txParent));
70
+ testPool.removeRecursive (CTransaction (txParent), REMOVAL_REASON_DUMMY );
69
71
BOOST_CHECK_EQUAL (testPool.size (), poolSize - 1 );
70
72
71
73
// Parent, children, grandchildren:
@@ -77,18 +79,18 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
77
79
}
78
80
// Remove Child[0], GrandChild[0] should be removed:
79
81
poolSize = testPool.size ();
80
- testPool.removeRecursive (CTransaction (txChild[0 ]));
82
+ testPool.removeRecursive (CTransaction (txChild[0 ]), REMOVAL_REASON_DUMMY );
81
83
BOOST_CHECK_EQUAL (testPool.size (), poolSize - 2 );
82
84
// ... make sure grandchild and child are gone:
83
85
poolSize = testPool.size ();
84
- testPool.removeRecursive (CTransaction (txGrandChild[0 ]));
86
+ testPool.removeRecursive (CTransaction (txGrandChild[0 ]), REMOVAL_REASON_DUMMY );
85
87
BOOST_CHECK_EQUAL (testPool.size (), poolSize);
86
88
poolSize = testPool.size ();
87
- testPool.removeRecursive (CTransaction (txChild[0 ]));
89
+ testPool.removeRecursive (CTransaction (txChild[0 ]), REMOVAL_REASON_DUMMY );
88
90
BOOST_CHECK_EQUAL (testPool.size (), poolSize);
89
91
// Remove parent, all children/grandchildren should go:
90
92
poolSize = testPool.size ();
91
- testPool.removeRecursive (CTransaction (txParent));
93
+ testPool.removeRecursive (CTransaction (txParent), REMOVAL_REASON_DUMMY );
92
94
BOOST_CHECK_EQUAL (testPool.size (), poolSize - 5 );
93
95
BOOST_CHECK_EQUAL (testPool.size (), 0U );
94
96
@@ -101,7 +103,7 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
101
103
// Now remove the parent, as might happen if a block-re-org occurs but the parent cannot be
102
104
// put into the mempool (maybe because it is non-standard):
103
105
poolSize = testPool.size ();
104
- testPool.removeRecursive (CTransaction (txParent));
106
+ testPool.removeRecursive (CTransaction (txParent), REMOVAL_REASON_DUMMY );
105
107
BOOST_CHECK_EQUAL (testPool.size (), poolSize - 6 );
106
108
BOOST_CHECK_EQUAL (testPool.size (), 0U );
107
109
}
@@ -283,11 +285,11 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
283
285
BOOST_CHECK_EQUAL (pool.size (), 10U );
284
286
285
287
// Now try removing tx10 and verify the sort order returns to normal
286
- pool.removeRecursive (pool.mapTx .find (tx10.GetHash ())->GetTx ());
288
+ pool.removeRecursive (pool.mapTx .find (tx10.GetHash ())->GetTx (), REMOVAL_REASON_DUMMY );
287
289
CheckSort<descendant_score>(pool, snapshotOrder);
288
290
289
- pool.removeRecursive (pool.mapTx .find (tx9.GetHash ())->GetTx ());
290
- pool.removeRecursive (pool.mapTx .find (tx8.GetHash ())->GetTx ());
291
+ pool.removeRecursive (pool.mapTx .find (tx9.GetHash ())->GetTx (), REMOVAL_REASON_DUMMY );
292
+ pool.removeRecursive (pool.mapTx .find (tx8.GetHash ())->GetTx (), REMOVAL_REASON_DUMMY );
291
293
}
292
294
293
295
BOOST_AUTO_TEST_CASE (MempoolAncestorIndexingTest)
0 commit comments