mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Merge 40c66bb3d1 into merged_master (Bitcoin PR #15855)
This commit is contained in:
commit
f6f2aefae3
11 changed files with 55 additions and 20 deletions
|
|
@ -67,18 +67,27 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup)
|
|||
|
||||
// Test 1: block with both of those transactions should be rejected.
|
||||
block = CreateAndProcessBlock(spends, scriptPubKey);
|
||||
BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() != block.GetHash());
|
||||
{
|
||||
LOCK(cs_main);
|
||||
BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() != block.GetHash());
|
||||
}
|
||||
|
||||
// Test 2: ... and should be rejected if spend1 is in the memory pool
|
||||
BOOST_CHECK(ToMemPool(spends[0]));
|
||||
block = CreateAndProcessBlock(spends, scriptPubKey);
|
||||
BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() != block.GetHash());
|
||||
{
|
||||
LOCK(cs_main);
|
||||
BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() != block.GetHash());
|
||||
}
|
||||
mempool.clear();
|
||||
|
||||
// Test 3: ... and should be rejected if spend2 is in the memory pool
|
||||
BOOST_CHECK(ToMemPool(spends[1]));
|
||||
block = CreateAndProcessBlock(spends, scriptPubKey);
|
||||
BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() != block.GetHash());
|
||||
{
|
||||
LOCK(cs_main);
|
||||
BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() != block.GetHash());
|
||||
}
|
||||
mempool.clear();
|
||||
|
||||
// Final sanity test: first spend in mempool, second in block, that's OK:
|
||||
|
|
@ -86,7 +95,10 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup)
|
|||
oneSpend.push_back(spends[0]);
|
||||
BOOST_CHECK(ToMemPool(spends[1]));
|
||||
block = CreateAndProcessBlock(oneSpend, scriptPubKey);
|
||||
BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() == block.GetHash());
|
||||
{
|
||||
LOCK(cs_main);
|
||||
BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() == block.GetHash());
|
||||
}
|
||||
// spends[1] should have been removed from the mempool when the
|
||||
// block with spends[0] is accepted:
|
||||
BOOST_CHECK_EQUAL(mempool.size(), 0U);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue