Bitcoin Core 28.99.0
P2P Digital Currency
Classes | Functions
validation_chainstatemanager_tests.cpp File Reference
#include <chainparams.h>
#include <consensus/validation.h>
#include <kernel/disconnected_transactions.h>
#include <node/chainstatemanager_args.h>
#include <node/kernel_notifications.h>
#include <node/utxo_snapshot.h>
#include <random.h>
#include <rpc/blockchain.h>
#include <sync.h>
#include <test/util/chainstate.h>
#include <test/util/logging.h>
#include <test/util/random.h>
#include <test/util/setup_common.h>
#include <test/util/validation.h>
#include <uint256.h>
#include <util/result.h>
#include <util/vector.h>
#include <validation.h>
#include <validationinterface.h>
#include <tinyformat.h>
#include <vector>
#include <boost/test/unit_test.hpp>
Include dependency graph for validation_chainstatemanager_tests.cpp:

Go to the source code of this file.

Classes

struct  SnapshotTestSetup
 

Functions

 BOOST_FIXTURE_TEST_CASE (chainstatemanager, TestChain100Setup)
 Basic tests for ChainstateManager. More...
 
 BOOST_FIXTURE_TEST_CASE (chainstatemanager_rebalance_caches, TestChain100Setup)
 Test rebalancing the caches associated with each chainstate. More...
 
 BOOST_FIXTURE_TEST_CASE (chainstatemanager_activate_snapshot, SnapshotTestSetup)
 Test basic snapshot activation. More...
 
 BOOST_FIXTURE_TEST_CASE (chainstatemanager_loadblockindex, TestChain100Setup)
 Test LoadBlockIndex behavior when multiple chainstates are in use. More...
 
 BOOST_FIXTURE_TEST_CASE (chainstatemanager_snapshot_init, SnapshotTestSetup)
 Ensure that snapshot chainstates initialize properly when found on disk. More...
 
 BOOST_FIXTURE_TEST_CASE (chainstatemanager_snapshot_completion, SnapshotTestSetup)
 
 BOOST_FIXTURE_TEST_CASE (chainstatemanager_snapshot_completion_hash_mismatch, SnapshotTestSetup)
 
template<typename Options >
util::Result< Options > SetOptsFromArgs (ArgsManager &args_man, Options opts, const std::vector< const char * > &args)
 Helper function to parse args into args_man and return the result of applying them to opts. More...
 
 BOOST_FIXTURE_TEST_CASE (chainstatemanager_args, BasicTestingSetup)
 

Function Documentation

◆ BOOST_FIXTURE_TEST_CASE() [1/8]

BOOST_FIXTURE_TEST_CASE ( chainstatemanager  ,
TestChain100Setup   
)

Basic tests for ChainstateManager.

First create a legacy (IBD) chainstate, then create a snapshot chainstate.

Definition at line 40 of file validation_chainstatemanager_tests.cpp.

Here is the call graph for this function:

◆ BOOST_FIXTURE_TEST_CASE() [2/8]

BOOST_FIXTURE_TEST_CASE ( chainstatemanager_activate_snapshot  ,
SnapshotTestSetup   
)

Test basic snapshot activation.

Definition at line 407 of file validation_chainstatemanager_tests.cpp.

◆ BOOST_FIXTURE_TEST_CASE() [3/8]

BOOST_FIXTURE_TEST_CASE ( chainstatemanager_args  ,
BasicTestingSetup   
)

Try to apply the provided args to a ChainstateManager::Options

Like get_opts, but requires the provided args to be valid and unwraps the result

Definition at line 790 of file validation_chainstatemanager_tests.cpp.

Here is the call graph for this function:

◆ BOOST_FIXTURE_TEST_CASE() [4/8]

BOOST_FIXTURE_TEST_CASE ( chainstatemanager_loadblockindex  ,
TestChain100Setup   
)

Test LoadBlockIndex behavior when multiple chainstates are in use.

  • First, verify that setBlockIndexCandidates is as expected when using a single, fully-validating chainstate.
  • Then mark a region of the chain as missing data and introduce a second chainstate that will tolerate assumed-valid blocks. Run LoadBlockIndex() and ensure that the first chainstate only contains fully validated blocks and the other chainstate contains all blocks, except those marked assume-valid, because those entries don't HAVE_DATA.

Definition at line 422 of file validation_chainstatemanager_tests.cpp.

Here is the call graph for this function:

◆ BOOST_FIXTURE_TEST_CASE() [5/8]

BOOST_FIXTURE_TEST_CASE ( chainstatemanager_rebalance_caches  ,
TestChain100Setup   
)

Test rebalancing the caches associated with each chainstate.

Definition at line 112 of file validation_chainstatemanager_tests.cpp.

Here is the call graph for this function:

◆ BOOST_FIXTURE_TEST_CASE() [6/8]

BOOST_FIXTURE_TEST_CASE ( chainstatemanager_snapshot_completion  ,
SnapshotTestSetup   
)

Definition at line 625 of file validation_chainstatemanager_tests.cpp.

Here is the call graph for this function:

◆ BOOST_FIXTURE_TEST_CASE() [7/8]

BOOST_FIXTURE_TEST_CASE ( chainstatemanager_snapshot_completion_hash_mismatch  ,
SnapshotTestSetup   
)

Definition at line 708 of file validation_chainstatemanager_tests.cpp.

Here is the call graph for this function:

◆ BOOST_FIXTURE_TEST_CASE() [8/8]

BOOST_FIXTURE_TEST_CASE ( chainstatemanager_snapshot_init  ,
SnapshotTestSetup   
)

Ensure that snapshot chainstates initialize properly when found on disk.

Definition at line 556 of file validation_chainstatemanager_tests.cpp.

Here is the call graph for this function:

◆ SetOptsFromArgs()

template<typename Options >
util::Result< Options > SetOptsFromArgs ( ArgsManager args_man,
Options  opts,
const std::vector< const char * > &  args 
)

Helper function to parse args into args_man and return the result of applying them to opts.

Definition at line 777 of file validation_chainstatemanager_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: