mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
remove internal tracking of mempool conflicts for reporting to wallet
This commit is contained in:
@@ -55,17 +55,17 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
|
||||
|
||||
|
||||
CTxMemPool testPool(CFeeRate(0));
|
||||
std::vector<CTransactionRef> removed;
|
||||
|
||||
// Nothing in pool, remove should do nothing:
|
||||
testPool.removeRecursive(txParent, &removed);
|
||||
BOOST_CHECK_EQUAL(removed.size(), 0);
|
||||
unsigned int poolSize = testPool.size();
|
||||
testPool.removeRecursive(txParent);
|
||||
BOOST_CHECK_EQUAL(testPool.size(), poolSize);
|
||||
|
||||
// Just the parent:
|
||||
testPool.addUnchecked(txParent.GetHash(), entry.FromTx(txParent));
|
||||
testPool.removeRecursive(txParent, &removed);
|
||||
BOOST_CHECK_EQUAL(removed.size(), 1);
|
||||
removed.clear();
|
||||
poolSize = testPool.size();
|
||||
testPool.removeRecursive(txParent);
|
||||
BOOST_CHECK_EQUAL(testPool.size(), poolSize - 1);
|
||||
|
||||
// Parent, children, grandchildren:
|
||||
testPool.addUnchecked(txParent.GetHash(), entry.FromTx(txParent));
|
||||
@@ -75,19 +75,21 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
|
||||
testPool.addUnchecked(txGrandChild[i].GetHash(), entry.FromTx(txGrandChild[i]));
|
||||
}
|
||||
// Remove Child[0], GrandChild[0] should be removed:
|
||||
testPool.removeRecursive(txChild[0], &removed);
|
||||
BOOST_CHECK_EQUAL(removed.size(), 2);
|
||||
removed.clear();
|
||||
poolSize = testPool.size();
|
||||
testPool.removeRecursive(txChild[0]);
|
||||
BOOST_CHECK_EQUAL(testPool.size(), poolSize - 2);
|
||||
// ... make sure grandchild and child are gone:
|
||||
testPool.removeRecursive(txGrandChild[0], &removed);
|
||||
BOOST_CHECK_EQUAL(removed.size(), 0);
|
||||
testPool.removeRecursive(txChild[0], &removed);
|
||||
BOOST_CHECK_EQUAL(removed.size(), 0);
|
||||
poolSize = testPool.size();
|
||||
testPool.removeRecursive(txGrandChild[0]);
|
||||
BOOST_CHECK_EQUAL(testPool.size(), poolSize);
|
||||
poolSize = testPool.size();
|
||||
testPool.removeRecursive(txChild[0]);
|
||||
BOOST_CHECK_EQUAL(testPool.size(), poolSize);
|
||||
// Remove parent, all children/grandchildren should go:
|
||||
testPool.removeRecursive(txParent, &removed);
|
||||
BOOST_CHECK_EQUAL(removed.size(), 5);
|
||||
poolSize = testPool.size();
|
||||
testPool.removeRecursive(txParent);
|
||||
BOOST_CHECK_EQUAL(testPool.size(), poolSize - 5);
|
||||
BOOST_CHECK_EQUAL(testPool.size(), 0);
|
||||
removed.clear();
|
||||
|
||||
// Add children and grandchildren, but NOT the parent (simulate the parent being in a block)
|
||||
for (int i = 0; i < 3; i++)
|
||||
@@ -97,10 +99,10 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
|
||||
}
|
||||
// Now remove the parent, as might happen if a block-re-org occurs but the parent cannot be
|
||||
// put into the mempool (maybe because it is non-standard):
|
||||
testPool.removeRecursive(txParent, &removed);
|
||||
BOOST_CHECK_EQUAL(removed.size(), 6);
|
||||
poolSize = testPool.size();
|
||||
testPool.removeRecursive(txParent);
|
||||
BOOST_CHECK_EQUAL(testPool.size(), poolSize - 6);
|
||||
BOOST_CHECK_EQUAL(testPool.size(), 0);
|
||||
removed.clear();
|
||||
}
|
||||
|
||||
template<typename name>
|
||||
|
||||
Reference in New Issue
Block a user