mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 06:43:45 +01:00
Merge bitcoin/bitcoin#19909: refactor: Remove unused CTxMemPool::clear() helper
fa818e103ctxmempool: Remove unused clear() member function (MarcoFalke) Pull request description: Seems odd to have code in Bitcoin Core that is unused. Moreover the function was broken (see https://github.com/bitcoin/bitcoin/pull/24145) and is brittle, as there is nothing that prevents similar bugs from re-appearing. Fix both issues by replacing it with C++11 member initializers. ACKs for top commit: glozow: ACKfa818e103cTree-SHA512: e79e44cac7d5a84d9ecc8e3f3b0b9a50e1e3ebec358b20ba5dac175ef07d1fbe338a20f83ee80f746f7c726c79e77f8be49e14bca57a41063da8a5302123c3a9
This commit is contained in:
@@ -77,7 +77,9 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, Dersig100Setup)
|
||||
LOCK(cs_main);
|
||||
BOOST_CHECK(m_node.chainman->ActiveChain().Tip()->GetBlockHash() != block.GetHash());
|
||||
}
|
||||
m_node.mempool->clear();
|
||||
BOOST_CHECK_EQUAL(m_node.mempool->size(), 1U);
|
||||
WITH_LOCK(m_node.mempool->cs, m_node.mempool->removeRecursive(CTransaction{spends[0]}, MemPoolRemovalReason::CONFLICT));
|
||||
BOOST_CHECK_EQUAL(m_node.mempool->size(), 0U);
|
||||
|
||||
// Test 3: ... and should be rejected if spend2 is in the memory pool
|
||||
BOOST_CHECK(ToMemPool(spends[1]));
|
||||
@@ -86,7 +88,9 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, Dersig100Setup)
|
||||
LOCK(cs_main);
|
||||
BOOST_CHECK(m_node.chainman->ActiveChain().Tip()->GetBlockHash() != block.GetHash());
|
||||
}
|
||||
m_node.mempool->clear();
|
||||
BOOST_CHECK_EQUAL(m_node.mempool->size(), 1U);
|
||||
WITH_LOCK(m_node.mempool->cs, m_node.mempool->removeRecursive(CTransaction{spends[1]}, MemPoolRemovalReason::CONFLICT));
|
||||
BOOST_CHECK_EQUAL(m_node.mempool->size(), 0U);
|
||||
|
||||
// Final sanity test: first spend in *m_node.mempool, second in block, that's OK:
|
||||
std::vector<CMutableTransaction> oneSpend;
|
||||
|
||||
Reference in New Issue
Block a user