MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / LoadVerifyActivateChainstate

Method LoadVerifyActivateChainstate

src/test/util/setup_common.cpp:349–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349void ChainTestingSetup::LoadVerifyActivateChainstate()
350{
351 auto& chainman{*Assert(m_node.chainman)};
352 node::ChainstateLoadOptions options;
353 options.mempool = Assert(m_node.mempool.get());
354 options.coins_db_in_memory = m_coins_db_in_memory;
355 options.wipe_chainstate_db = m_args.GetBoolArg("-reindex", false) || m_args.GetBoolArg("-reindex-chainstate", false);
356 options.prune = chainman.m_blockman.IsPruneMode();
357 options.check_blocks = m_args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS);
358 options.check_level = m_args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL);
359 options.require_full_verification = m_args.IsArgSet("-checkblocks") || m_args.IsArgSet("-checklevel");
360 auto [status, error] = LoadChainstate(chainman, m_kernel_cache_sizes, options);
361 assert(status == node::ChainstateLoadStatus::SUCCESS);
362
363 std::tie(status, error) = VerifyLoadedChainstate(chainman, options);
364 assert(status == node::ChainstateLoadStatus::SUCCESS);
365
366 m_node.notifications->setChainstateLoaded(true);
367
368 BlockValidationState state;
369 if (!chainman.ActiveChainstate().ActivateBestChain(state)) {
370 throw std::runtime_error(strprintf("ActivateBestChain failed. (%s)", state.ToString()));
371 }
372}
373
374TestingSetup::TestingSetup(
375 const ChainType chainType,

Callers 6

BOOST_FIXTURE_TEST_CASEFunction · 0.80
FUZZ_TARGETFunction · 0.80
ResetChainmanFunction · 0.80
utxo_snapshot_fuzzFunction · 0.80
ResetChainmanAndMempoolFunction · 0.80
ResetChainmanFunction · 0.80

Calls 8

LoadChainstateFunction · 0.85
VerifyLoadedChainstateFunction · 0.85
GetBoolArgMethod · 0.80
IsPruneModeMethod · 0.80
IsArgSetMethod · 0.80
ActivateBestChainMethod · 0.80
getMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected