@@ -55,17 +55,17 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
55
55
56
56
57
57
CTxMemPool testPool (CFeeRate (0 ));
58
- std::vector<CTransactionRef> removed;
59
58
60
59
// Nothing in pool, remove should do nothing:
61
- testPool.removeRecursive (txParent, &removed);
62
- BOOST_CHECK_EQUAL (removed.size (), 0 );
60
+ unsigned int poolSize = testPool.size ();
61
+ testPool.removeRecursive (txParent);
62
+ BOOST_CHECK_EQUAL (testPool.size (), poolSize);
63
63
64
64
// Just the parent:
65
65
testPool.addUnchecked (txParent.GetHash (), entry.FromTx (txParent));
66
- testPool.removeRecursive (txParent, &removed );
67
- BOOST_CHECK_EQUAL (removed. size (), 1 );
68
- removed. clear ( );
66
+ poolSize = testPool.size ( );
67
+ testPool. removeRecursive (txParent );
68
+ BOOST_CHECK_EQUAL (testPool. size (), poolSize - 1 );
69
69
70
70
// Parent, children, grandchildren:
71
71
testPool.addUnchecked (txParent.GetHash (), entry.FromTx (txParent));
@@ -75,19 +75,21 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
75
75
testPool.addUnchecked (txGrandChild[i].GetHash (), entry.FromTx (txGrandChild[i]));
76
76
}
77
77
// Remove Child[0], GrandChild[0] should be removed:
78
- testPool.removeRecursive (txChild[ 0 ], &removed );
79
- BOOST_CHECK_EQUAL (removed. size (), 2 );
80
- removed. clear ( );
78
+ poolSize = testPool.size ( );
79
+ testPool. removeRecursive (txChild[ 0 ] );
80
+ BOOST_CHECK_EQUAL (testPool. size (), poolSize - 2 );
81
81
// ... make sure grandchild and child are gone:
82
- testPool.removeRecursive (txGrandChild[0 ], &removed);
83
- BOOST_CHECK_EQUAL (removed.size (), 0 );
84
- testPool.removeRecursive (txChild[0 ], &removed);
85
- BOOST_CHECK_EQUAL (removed.size (), 0 );
82
+ poolSize = testPool.size ();
83
+ testPool.removeRecursive (txGrandChild[0 ]);
84
+ BOOST_CHECK_EQUAL (testPool.size (), poolSize);
85
+ poolSize = testPool.size ();
86
+ testPool.removeRecursive (txChild[0 ]);
87
+ BOOST_CHECK_EQUAL (testPool.size (), poolSize);
86
88
// Remove parent, all children/grandchildren should go:
87
- testPool.removeRecursive (txParent, &removed);
88
- BOOST_CHECK_EQUAL (removed.size (), 5 );
89
+ poolSize = testPool.size ();
90
+ testPool.removeRecursive (txParent);
91
+ BOOST_CHECK_EQUAL (testPool.size (), poolSize - 5 );
89
92
BOOST_CHECK_EQUAL (testPool.size (), 0 );
90
- removed.clear ();
91
93
92
94
// Add children and grandchildren, but NOT the parent (simulate the parent being in a block)
93
95
for (int i = 0 ; i < 3 ; i++)
@@ -97,10 +99,10 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
97
99
}
98
100
// Now remove the parent, as might happen if a block-re-org occurs but the parent cannot be
99
101
// put into the mempool (maybe because it is non-standard):
100
- testPool.removeRecursive (txParent, &removed);
101
- BOOST_CHECK_EQUAL (removed.size (), 6 );
102
+ poolSize = testPool.size ();
103
+ testPool.removeRecursive (txParent);
104
+ BOOST_CHECK_EQUAL (testPool.size (), poolSize - 6 );
102
105
BOOST_CHECK_EQUAL (testPool.size (), 0 );
103
- removed.clear ();
104
106
}
105
107
106
108
template <typename name>
0 commit comments