|
|
|
@ -58,12 +58,12 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
@@ -58,12 +58,12 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
|
|
|
|
|
std::list<CTransaction> removed; |
|
|
|
|
|
|
|
|
|
// Nothing in pool, remove should do nothing:
|
|
|
|
|
testPool.removeRecursive(txParent, removed); |
|
|
|
|
testPool.removeRecursive(txParent, &removed); |
|
|
|
|
BOOST_CHECK_EQUAL(removed.size(), 0); |
|
|
|
|
|
|
|
|
|
// Just the parent:
|
|
|
|
|
testPool.addUnchecked(txParent.GetHash(), entry.FromTx(txParent)); |
|
|
|
|
testPool.removeRecursive(txParent, removed); |
|
|
|
|
testPool.removeRecursive(txParent, &removed); |
|
|
|
|
BOOST_CHECK_EQUAL(removed.size(), 1); |
|
|
|
|
removed.clear(); |
|
|
|
|
|
|
|
|
@ -75,16 +75,16 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
@@ -75,16 +75,16 @@ 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); |
|
|
|
|
testPool.removeRecursive(txChild[0], &removed); |
|
|
|
|
BOOST_CHECK_EQUAL(removed.size(), 2); |
|
|
|
|
removed.clear(); |
|
|
|
|
// ... make sure grandchild and child are gone:
|
|
|
|
|
testPool.removeRecursive(txGrandChild[0], removed); |
|
|
|
|
testPool.removeRecursive(txGrandChild[0], &removed); |
|
|
|
|
BOOST_CHECK_EQUAL(removed.size(), 0); |
|
|
|
|
testPool.removeRecursive(txChild[0], removed); |
|
|
|
|
testPool.removeRecursive(txChild[0], &removed); |
|
|
|
|
BOOST_CHECK_EQUAL(removed.size(), 0); |
|
|
|
|
// Remove parent, all children/grandchildren should go:
|
|
|
|
|
testPool.removeRecursive(txParent, removed); |
|
|
|
|
testPool.removeRecursive(txParent, &removed); |
|
|
|
|
BOOST_CHECK_EQUAL(removed.size(), 5); |
|
|
|
|
BOOST_CHECK_EQUAL(testPool.size(), 0); |
|
|
|
|
removed.clear(); |
|
|
|
@ -97,7 +97,7 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
@@ -97,7 +97,7 @@ 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); |
|
|
|
|
testPool.removeRecursive(txParent, &removed); |
|
|
|
|
BOOST_CHECK_EQUAL(removed.size(), 6); |
|
|
|
|
BOOST_CHECK_EQUAL(testPool.size(), 0); |
|
|
|
|
removed.clear(); |
|
|
|
@ -281,12 +281,11 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
@@ -281,12 +281,11 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
|
|
|
|
|
BOOST_CHECK_EQUAL(pool.size(), 10); |
|
|
|
|
|
|
|
|
|
// Now try removing tx10 and verify the sort order returns to normal
|
|
|
|
|
std::list<CTransaction> removed; |
|
|
|
|
pool.removeRecursive(pool.mapTx.find(tx10.GetHash())->GetTx(), removed); |
|
|
|
|
pool.removeRecursive(pool.mapTx.find(tx10.GetHash())->GetTx()); |
|
|
|
|
CheckSort<descendant_score>(pool, snapshotOrder); |
|
|
|
|
|
|
|
|
|
pool.removeRecursive(pool.mapTx.find(tx9.GetHash())->GetTx(), removed); |
|
|
|
|
pool.removeRecursive(pool.mapTx.find(tx8.GetHash())->GetTx(), removed); |
|
|
|
|
pool.removeRecursive(pool.mapTx.find(tx9.GetHash())->GetTx()); |
|
|
|
|
pool.removeRecursive(pool.mapTx.find(tx8.GetHash())->GetTx()); |
|
|
|
|
/* Now check the sort on the mining score index.
|
|
|
|
|
* Final order should be: |
|
|
|
|
* |
|
|
|
@ -413,8 +412,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
@@ -413,8 +412,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
|
|
|
|
|
/* after tx6 is mined, tx7 should move up in the sort */ |
|
|
|
|
std::vector<CTransaction> vtx; |
|
|
|
|
vtx.push_back(tx6); |
|
|
|
|
std::list<CTransaction> dummy; |
|
|
|
|
pool.removeForBlock(vtx, 1, dummy, false); |
|
|
|
|
pool.removeForBlock(vtx, 1, NULL, false); |
|
|
|
|
|
|
|
|
|
sortedOrder.erase(sortedOrder.begin()+1); |
|
|
|
|
sortedOrder.pop_back(); |
|
|
|
@ -549,12 +547,11 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
@@ -549,12 +547,11 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
|
|
|
|
|
pool.addUnchecked(tx7.GetHash(), entry.Fee(9000LL).FromTx(tx7, &pool)); |
|
|
|
|
|
|
|
|
|
std::vector<CTransaction> vtx; |
|
|
|
|
std::list<CTransaction> conflicts; |
|
|
|
|
SetMockTime(42); |
|
|
|
|
SetMockTime(42 + CTxMemPool::ROLLING_FEE_HALFLIFE); |
|
|
|
|
BOOST_CHECK_EQUAL(pool.GetMinFee(1).GetFeePerK(), maxFeeRateRemoved.GetFeePerK() + 1000); |
|
|
|
|
// ... we should keep the same min fee until we get a block
|
|
|
|
|
pool.removeForBlock(vtx, 1, conflicts); |
|
|
|
|
pool.removeForBlock(vtx, 1); |
|
|
|
|
SetMockTime(42 + 2*CTxMemPool::ROLLING_FEE_HALFLIFE); |
|
|
|
|
BOOST_CHECK_EQUAL(pool.GetMinFee(1).GetFeePerK(), (maxFeeRateRemoved.GetFeePerK() + 1000)/2); |
|
|
|
|
// ... then feerate should drop 1/2 each halflife
|
|
|
|
|