diff options
author | Carl Dong <contact@carldong.me> | 2021-09-20 14:02:07 -0400 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2021-12-07 14:48:49 -0500 |
commit | 15f2e33bb3d1ad3bc997f6a84956337f46495091 (patch) | |
tree | f645b983981d41f2da59acd1e6c0f11c3e5a9830 /src/node | |
parent | 4da9c076d1cf12728730bb1f7e8906d4e9bfaba5 (diff) |
validation: VerifyDB only needs Consensus::Params
Previously we were passing in CChainParams, when VerifyDB only needed
the Consensus::Params subset.
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/chainstate.cpp | 10 | ||||
-rw-r--r-- | src/node/chainstate.h | 8 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/node/chainstate.cpp b/src/node/chainstate.cpp index c112bc949a..b4264655d5 100644 --- a/src/node/chainstate.cpp +++ b/src/node/chainstate.cpp @@ -4,7 +4,7 @@ #include <node/chainstate.h> -#include <chainparams.h> // for CChainParams +#include <consensus/params.h> // for Consensus::Params #include <node/blockstorage.h> // for CleanupBlockRevFiles, fHavePruned, fReindex #include <validation.h> // for a lot of things @@ -12,7 +12,7 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset, ChainstateManager& chainman, CTxMemPool* mempool, bool fPruneMode, - const CChainParams& chainparams, + const Consensus::Params& consensus_params, bool fReindexChainState, int64_t nBlockTreeDBCache, int64_t nCoinDBCache, @@ -57,7 +57,7 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset, } if (!chainman.BlockIndex().empty() && - !chainman.m_blockman.LookupBlockIndex(chainparams.GetConsensus().hashGenesisBlock)) { + !chainman.m_blockman.LookupBlockIndex(consensus_params.hashGenesisBlock)) { return ChainstateLoadingError::ERROR_BAD_GENESIS_BLOCK; } @@ -128,7 +128,7 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset, std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManager& chainman, bool fReset, bool fReindexChainState, - const CChainParams& chainparams, + const Consensus::Params& consensus_params, unsigned int check_blocks, unsigned int check_level, std::function<int64_t()> get_unix_time_seconds) @@ -148,7 +148,7 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage } if (!CVerifyDB().VerifyDB( - *chainstate, chainparams, chainstate->CoinsDB(), + *chainstate, consensus_params, chainstate->CoinsDB(), check_level, check_blocks)) { return ChainstateLoadVerifyError::ERROR_CORRUPTED_BLOCK_DB; diff --git a/src/node/chainstate.h b/src/node/chainstate.h index 735906a540..e3369eb47c 100644 --- a/src/node/chainstate.h +++ b/src/node/chainstate.h @@ -9,8 +9,10 @@ #include <functional> // for std::function #include <optional> // for std::optional -class CChainParams; class ChainstateManager; +namespace Consensus { + struct Params; +} class CTxMemPool; enum class ChainstateLoadingError { @@ -56,7 +58,7 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset, ChainstateManager& chainman, CTxMemPool* mempool, bool fPruneMode, - const CChainParams& chainparams, + const Consensus::Params& consensus_params, bool fReindexChainState, int64_t nBlockTreeDBCache, int64_t nCoinDBCache, @@ -73,7 +75,7 @@ enum class ChainstateLoadVerifyError { std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManager& chainman, bool fReset, bool fReindexChainState, - const CChainParams& chainparams, + const Consensus::Params& consensus_params, unsigned int check_blocks, unsigned int check_level, std::function<int64_t()> get_unix_time_seconds); |