diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3575,7 +3575,7 @@ * in ConnectBlock(). * Note that -reindex-chainstate skips the validation that happens here! */ -static bool ContextualCheckBlockHeader(const Config &config, +static bool ContextualCheckBlockHeader(const CChainParams ¶ms, const CBlockHeader &block, CValidationState &state, const CBlockIndex *pindexPrev, @@ -3584,8 +3584,7 @@ const int nHeight = pindexPrev->nHeight + 1; // Check proof of work - const Consensus::Params &consensusParams = - config.GetChainParams().GetConsensus(); + const Consensus::Params &consensusParams = params.GetConsensus(); if (block.nBits != GetNextWorkRequired(pindexPrev, &block, consensusParams)) { LogPrintf("bad bits after height: %d\n", pindexPrev->nHeight); @@ -3595,8 +3594,7 @@ // Check against checkpoints if (fCheckpointsEnabled) { - const CCheckpointData &checkpoints = - config.GetChainParams().Checkpoints(); + const CCheckpointData &checkpoints = params.Checkpoints(); // Check that the block chain matches the known block chain up to a // checkpoint. @@ -3812,7 +3810,7 @@ REJECT_INVALID, "bad-prevblk"); } - if (!ContextualCheckBlockHeader(config, block, state, pindexPrev, + if (!ContextualCheckBlockHeader(chainparams, block, state, pindexPrev, GetAdjustedTime())) { return error("%s: Consensus::ContextualCheckBlockHeader: %s, %s", __func__, hash.ToString(), FormatStateMessage(state)); @@ -4132,8 +4130,8 @@ indexDummy.phashBlock = &block_hash; // NOTE: CheckBlockHeader is called by CheckBlock - if (!ContextualCheckBlockHeader(config, block, state, pindexPrev, - GetAdjustedTime())) { + if (!ContextualCheckBlockHeader(config.GetChainParams(), block, state, + pindexPrev, GetAdjustedTime())) { return error("%s: Consensus::ContextualCheckBlockHeader: %s", __func__, FormatStateMessage(state)); }