refactor: Reduce number of LoadChainstate return values

This commit is contained in:
Russell Yanofsky
2021-12-01 18:16:29 -05:00
parent 3b91d4b994
commit b3e7de7ee6
5 changed files with 65 additions and 137 deletions

View File

@@ -225,11 +225,11 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
options.prune = node::fPruneMode;
options.check_blocks = m_args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS);
options.check_level = m_args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL);
auto maybe_load_error = LoadChainstate(*Assert(m_node.chainman), m_cache_sizes, options);
assert(!maybe_load_error.has_value());
auto [status, error] = LoadChainstate(*Assert(m_node.chainman), m_cache_sizes, options);
assert(status == node::ChainstateLoadStatus::SUCCESS);
auto maybe_verify_error = VerifyLoadedChainstate(*Assert(m_node.chainman), options);
assert(!maybe_verify_error.has_value());
std::tie(status, error) = VerifyLoadedChainstate(*Assert(m_node.chainman), options);
assert(status == node::ChainstateLoadStatus::SUCCESS);
BlockValidationState state;
if (!m_node.chainman->ActiveChainstate().ActivateBestChain(state)) {