diff options
author | Carl Dong <contact@carldong.me> | 2021-08-16 17:03:33 -0400 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2021-12-06 15:56:55 -0500 |
commit | c7a5c46e6fd6d6ff46ca7a65fc3f0fff3cbdb24e (patch) | |
tree | bf2095cf76e1e7f1677395f71c18d6feea62d922 /src/node | |
parent | ae9121f958a4124ea6238cad0c3f2acb8b9eb4bb (diff) | |
download | bitcoin-c7a5c46e6fd6d6ff46ca7a65fc3f0fff3cbdb24e.tar.xz |
node/chainstate: Decouple from ArgsManager
...instead pass in only the necessary information
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/chainstate.cpp | 11 | ||||
-rw-r--r-- | src/node/chainstate.h | 6 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/node/chainstate.cpp b/src/node/chainstate.cpp index fa39e2442d..3d02c52edb 100644 --- a/src/node/chainstate.cpp +++ b/src/node/chainstate.cpp @@ -18,11 +18,12 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset, NodeContext& node, bool fPruneMode, const CChainParams& chainparams, - const ArgsManager& args, bool fReindexChainState, int64_t nBlockTreeDBCache, int64_t nCoinDBCache, - int64_t nCoinCacheUsage) + int64_t nCoinCacheUsage, + unsigned int check_blocks, + unsigned int check_level) { auto is_coinsview_empty = [&](CChainState* chainstate) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) { return fReset || fReindexChainState || chainstate->CoinsTip().GetBestBlock().IsNull(); @@ -140,7 +141,7 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset, for (CChainState* chainstate : chainman.GetAll()) { if (!is_coinsview_empty(chainstate)) { uiInterface.InitMessage(_("Verifying blocks…").translated); - if (fHavePruned && args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS) > MIN_BLOCKS_TO_KEEP) { + if (fHavePruned && check_blocks > MIN_BLOCKS_TO_KEEP) { LogPrintf("Prune: pruned datadir may not have more than %d blocks; only checking available blocks\n", MIN_BLOCKS_TO_KEEP); } @@ -153,8 +154,8 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset, if (!CVerifyDB().VerifyDB( *chainstate, chainparams, chainstate->CoinsDB(), - args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL), - args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS))) { + check_level, + check_blocks)) { return ChainstateLoadingError::ERROR_CORRUPTED_BLOCK_DB; } } diff --git a/src/node/chainstate.h b/src/node/chainstate.h index 921b8d89e5..87aad23e27 100644 --- a/src/node/chainstate.h +++ b/src/node/chainstate.h @@ -8,7 +8,6 @@ #include <cstdint> // for int64_t #include <optional> // for std::optional -class ArgsManager; class CChainParams; class ChainstateManager; struct NodeContext; @@ -59,10 +58,11 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset, NodeContext& node, bool fPruneMode, const CChainParams& chainparams, - const ArgsManager& args, bool fReindexChainState, int64_t nBlockTreeDBCache, int64_t nCoinDBCache, - int64_t nCoinCacheUsage); + int64_t nCoinCacheUsage, + unsigned int check_blocks, + unsigned int check_level); #endif // BITCOIN_NODE_CHAINSTATE_H |