mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-31 16:24:48 +02:00
Merge bitcoin/bitcoin#26900: refactor: Add BlockManager getters
faf7b4f1fcAdd BlockManager::IsPruneMode() (MarcoFalke)fae71fe27eAdd BlockManager::GetPruneTarget() (MarcoFalke)fa0f0436d8Add BlockManager::LoadingBlocks() (MarcoFalke) Pull request description: Requested in https://github.com/bitcoin/bitcoin/pull/25781#discussion_r1061323795, but adding getters seems unrelated from removing globals, so I split it out for now. ACKs for top commit: dergoegge: Code review ACKfaf7b4f1fcbrunoerg: crACKfaf7b4f1fcTree-SHA512: 204d0e9a0e8b78175482f89b4ce620fba0e65d8e49ad845d187af44d3843f4c733a01bac1ffe5a5319f524d8346123693a456778b69d6c75268c447eb8839642
This commit is contained in:
@@ -208,23 +208,24 @@ ChainTestingSetup::~ChainTestingSetup()
|
||||
|
||||
void TestingSetup::LoadVerifyActivateChainstate()
|
||||
{
|
||||
auto& chainman{*Assert(m_node.chainman)};
|
||||
node::ChainstateLoadOptions options;
|
||||
options.mempool = Assert(m_node.mempool.get());
|
||||
options.block_tree_db_in_memory = m_block_tree_db_in_memory;
|
||||
options.coins_db_in_memory = m_coins_db_in_memory;
|
||||
options.reindex = node::fReindex;
|
||||
options.reindex_chainstate = m_args.GetBoolArg("-reindex-chainstate", false);
|
||||
options.prune = node::fPruneMode;
|
||||
options.prune = chainman.m_blockman.IsPruneMode();
|
||||
options.check_blocks = m_args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS);
|
||||
options.check_level = m_args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL);
|
||||
auto [status, error] = LoadChainstate(*Assert(m_node.chainman), m_cache_sizes, options);
|
||||
auto [status, error] = LoadChainstate(chainman, m_cache_sizes, options);
|
||||
assert(status == node::ChainstateLoadStatus::SUCCESS);
|
||||
|
||||
std::tie(status, error) = VerifyLoadedChainstate(*Assert(m_node.chainman), options);
|
||||
std::tie(status, error) = VerifyLoadedChainstate(chainman, options);
|
||||
assert(status == node::ChainstateLoadStatus::SUCCESS);
|
||||
|
||||
BlockValidationState state;
|
||||
if (!m_node.chainman->ActiveChainstate().ActivateBestChain(state)) {
|
||||
if (!chainman.ActiveChainstate().ActivateBestChain(state)) {
|
||||
throw std::runtime_error(strprintf("ActivateBestChain failed. (%s)", state.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user