@@ -55,17 +55,17 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
5555
5656
5757 CTxMemPool testPool (CFeeRate (0 ));
58- std::vector<CTransactionRef> removed;
5958
6059 // 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);
6363
6464 // Just the parent:
6565 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 );
6969
7070 // Parent, children, grandchildren:
7171 testPool.addUnchecked (txParent.GetHash (), entry.FromTx (txParent));
@@ -75,19 +75,21 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
7575 testPool.addUnchecked (txGrandChild[i].GetHash (), entry.FromTx (txGrandChild[i]));
7676 }
7777 // 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 );
8181 // ... 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);
8688 // 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 );
8992 BOOST_CHECK_EQUAL (testPool.size (), 0 );
90- removed.clear ();
9193
9294 // Add children and grandchildren, but NOT the parent (simulate the parent being in a block)
9395 for (int i = 0 ; i < 3 ; i++)
@@ -97,10 +99,10 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
9799 }
98100 // Now remove the parent, as might happen if a block-re-org occurs but the parent cannot be
99101 // 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 );
102105 BOOST_CHECK_EQUAL (testPool.size (), 0 );
103- removed.clear ();
104106}
105107
106108template <typename name>
0 commit comments