| 347 | } |
| 348 | |
| 349 | void 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 | |
| 374 | TestingSetup::TestingSetup( |
| 375 | const ChainType chainType, |
no test coverage detected