diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2021-12-01 18:16:29 -0500 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2022-07-19 15:54:52 -0500 |
commit | 3b91d4b9947adbec74721f538e46c712db22587c (patch) | |
tree | f5fb6c690a92727ff492a1ae2dce4058052ac885 /src/test | |
parent | 5560682a4464852eb3c244c1ddf9eea02dc962b2 (diff) |
refactor: Reduce number of LoadChainstate parameters
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/util/setup_common.cpp | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 0fba9258f1..db5937121b 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -54,8 +54,6 @@ using node::BlockAssembler; using node::CalculateCacheSizes; -using node::fPruneMode; -using node::fReindex; using node::LoadChainstate; using node::NodeContext; using node::RegenerateCommitments; @@ -218,24 +216,19 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const // instead of unit tests, but for now we need these here. RegisterAllCoreRPCCommands(tableRPC); - auto maybe_load_error = LoadChainstate(fReindex.load(), - *Assert(m_node.chainman.get()), - Assert(m_node.mempool.get()), - fPruneMode, - m_args.GetBoolArg("-reindex-chainstate", false), - m_cache_sizes.block_tree_db, - m_cache_sizes.coins_db, - m_cache_sizes.coins, - /*block_tree_db_in_memory=*/true, - /*coins_db_in_memory=*/true); + node::ChainstateLoadOptions options; + options.mempool = Assert(m_node.mempool.get()); + options.block_tree_db_in_memory = true; + options.coins_db_in_memory = true; + options.reindex = node::fReindex; + options.reindex_chainstate = m_args.GetBoolArg("-reindex-chainstate", false); + 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 maybe_verify_error = VerifyLoadedChainstate( - *Assert(m_node.chainman), - fReindex.load(), - m_args.GetBoolArg("-reindex-chainstate", false), - m_args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS), - m_args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL)); + auto maybe_verify_error = VerifyLoadedChainstate(*Assert(m_node.chainman), options); assert(!maybe_verify_error.has_value()); BlockValidationState state; |