44
55#include < node/chainstate.h>
66
7- #include < chainparams .h> // for CChainParams
7+ #include < consensus/params .h> // for Consensus::Params
88#include < deploymentstatus.h> // for DeploymentActiveAfter
99#include < node/blockstorage.h> // for CleanupBlockRevFiles, fHavePruned, fReindex
1010#include < validation.h> // for a lot of things
@@ -42,7 +42,8 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
4242 bool is_spentindex_enabled,
4343 bool is_timeindex_enabled,
4444 bool is_txindex_enabled,
45- const CChainParams& chainparams,
45+ const Consensus::Params& consensus_params,
46+ const std::string& network_id,
4647 bool fReindexChainState ,
4748 int64_t nBlockTreeDBCache,
4849 int64_t nCoinDBCache,
@@ -97,7 +98,7 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
9798
9899 chain_helper.reset ();
99100 chain_helper = std::make_unique<CChainstateHelper>(*cpoolman, *dmnman, *mnhf_manager, govman, *(llmq_ctx->quorum_block_processor ), chainman,
100- chainparams. GetConsensus () , mn_sync, sporkman, *(llmq_ctx->clhandler ), *(llmq_ctx->qman ));
101+ consensus_params , mn_sync, sporkman, *(llmq_ctx->clhandler ), *(llmq_ctx->qman ));
101102
102103 if (fReset ) {
103104 pblocktree->WriteReindexing (true );
@@ -119,17 +120,17 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
119120
120121 // TODO: Remove this when pruning is fixed.
121122 // See https://github.com/dashpay/dash/pull/1817 and https://github.com/dashpay/dash/pull/1743
122- if (is_governance_enabled && !is_txindex_enabled && chainparams. NetworkIDString () != CBaseChainParams::REGTEST) {
123+ if (is_governance_enabled && !is_txindex_enabled && network_id != CBaseChainParams::REGTEST) {
123124 return ChainstateLoadingError::ERROR_TXINDEX_DISABLED_WHEN_GOV_ENABLED;
124125 }
125126
126127 if (!chainman.BlockIndex ().empty () &&
127- !chainman.m_blockman .LookupBlockIndex (chainparams. GetConsensus () .hashGenesisBlock )) {
128+ !chainman.m_blockman .LookupBlockIndex (consensus_params .hashGenesisBlock )) {
128129 return ChainstateLoadingError::ERROR_BAD_GENESIS_BLOCK;
129130 }
130131
131- if (!chainparams. GetConsensus () .hashDevnetGenesisBlock .IsNull () && !chainman.BlockIndex ().empty () &&
132- !chainman.m_blockman .LookupBlockIndex (chainparams. GetConsensus () .hashDevnetGenesisBlock )) {
132+ if (!consensus_params .hashDevnetGenesisBlock .IsNull () && !chainman.BlockIndex ().empty () &&
133+ !chainman.m_blockman .LookupBlockIndex (consensus_params .hashDevnetGenesisBlock )) {
133134 return ChainstateLoadingError::ERROR_BAD_DEVNET_GENESIS_BLOCK;
134135 }
135136
@@ -230,7 +231,7 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage
230231 CEvoDB& evodb,
231232 bool fReset ,
232233 bool fReindexChainState ,
233- const CChainParams& chainparams ,
234+ const Consensus::Params& consensus_params ,
234235 unsigned int check_blocks,
235236 unsigned int check_level,
236237 std::function<int64_t ()> get_unix_time_seconds)
@@ -248,14 +249,14 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage
248249 if (tip && tip->nTime > get_unix_time_seconds () + 2 * 60 * 60 ) {
249250 return ChainstateLoadVerifyError::ERROR_BLOCK_FROM_FUTURE;
250251 }
251- const bool v19active{DeploymentActiveAfter (tip, chainparams. GetConsensus () , Consensus::DEPLOYMENT_V19)};
252+ const bool v19active{DeploymentActiveAfter (tip, consensus_params , Consensus::DEPLOYMENT_V19)};
252253 if (v19active) {
253254 bls::bls_legacy_scheme.store (false );
254255 LogPrintf (" %s: bls_legacy_scheme=%d\n " , __func__, bls::bls_legacy_scheme.load ());
255256 }
256257
257258 if (!CVerifyDB ().VerifyDB (
258- *chainstate, chainparams , chainstate->CoinsDB (),
259+ *chainstate, consensus_params , chainstate->CoinsDB (),
259260 evodb,
260261 check_level,
261262 check_blocks)) {
0 commit comments