Bitcoin Core 28.99.0
P2P Digital Currency
Classes | Namespaces | Functions
validation_block_tests.cpp File Reference
#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>
Include dependency graph for validation_block_tests.cpp:

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)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/3]

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.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/3]

BOOST_AUTO_TEST_CASE ( processnewblock_signals_ordering  )

Definition at line 152 of file validation_block_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/3]

BOOST_AUTO_TEST_CASE ( witness_commitment_index  )

Definition at line 329 of file validation_block_tests.cpp.

Here is the call graph for this function: