Bitcoin Core 28.99.0
P2P Digital Currency
|
#include <boost/test/unit_test.hpp>
#include <chainparams.h>
#include <consensus/merkle.h>
#include <consensus/validation.h>
#include <node/miner.h>
#include <pow.h>
#include <random.h>
#include <test/util/random.h>
#include <test/util/script.h>
#include <test/util/setup_common.h>
#include <util/time.h>
#include <validation.h>
#include <validationinterface.h>
#include <thread>
Go to the source code of this file.
Classes | |
struct | validation_block_tests::MinerTestingSetup |
struct | TestSubscriber |
Namespaces | |
namespace | validation_block_tests |
Functions | |
BOOST_AUTO_TEST_CASE (processnewblock_signals_ordering) | |
BOOST_AUTO_TEST_CASE (mempool_locks_reorg) | |
Test that mempool updates happen atomically with reorgs. More... | |
BOOST_AUTO_TEST_CASE (witness_commitment_index) | |
BOOST_AUTO_TEST_CASE | ( | mempool_locks_reorg | ) |
Test that mempool updates happen atomically with reorgs.
This prevents RPC clients, among others, from retrieving immediately-out-of-date mempool data during large reorgs.
The test verifies this by creating a chain of num_txs
blocks, matures their coinbases, and then submits txns spending from their coinbase to the mempool. A fork chain is then processed, invalidating the txns and evicting them from the mempool.
We verify that the mempool updates atomically by polling it continuously from another thread during the reorg and checking that its size only changes once. The size changing exactly once indicates that the polling thread's view of the mempool is either consistent with the chain state before reorg, or consistent with the chain state after the reorg, and not just consistent with some intermediate state during the reorg.
Definition at line 227 of file validation_block_tests.cpp.
BOOST_AUTO_TEST_CASE | ( | processnewblock_signals_ordering | ) |
Definition at line 152 of file validation_block_tests.cpp.
BOOST_AUTO_TEST_CASE | ( | witness_commitment_index | ) |
Definition at line 329 of file validation_block_tests.cpp.