@@ -3525,10 +3525,9 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
3525
3525
return true ;
3526
3526
}
3527
3527
3528
- bool ContextualCheckBlock (const CBlock& block, CValidationState& state, const CBlockIndex* pindexPrev)
3528
+ bool ContextualCheckBlock (const CBlock& block, CValidationState& state, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev)
3529
3529
{
3530
3530
const int nHeight = pindexPrev == NULL ? 0 : pindexPrev->nHeight + 1 ;
3531
- const Consensus::Params& consensusParams = Params ().GetConsensus ();
3532
3531
3533
3532
// Start enforcing BIP113 (Median Time Past) using versionbits logic.
3534
3533
int nLockTimeFlags = 0 ;
@@ -3689,7 +3688,8 @@ static bool AcceptBlock(const CBlock& block, CValidationState& state, const CCha
3689
3688
}
3690
3689
if (fNewBlock ) *fNewBlock = true ;
3691
3690
3692
- if ((!CheckBlock (block, state, chainparams.GetConsensus (), GetAdjustedTime ())) || !ContextualCheckBlock (block, state, pindex->pprev )) {
3691
+ if (!CheckBlock (block, state, chainparams.GetConsensus (), GetAdjustedTime ()) ||
3692
+ !ContextualCheckBlock (block, state, chainparams.GetConsensus (), pindex->pprev )) {
3693
3693
if (state.IsInvalid () && !state.CorruptionPossible ()) {
3694
3694
pindex->nStatus |= BLOCK_FAILED_VALID;
3695
3695
setDirtyBlockIndex.insert (pindex);
@@ -3780,7 +3780,7 @@ bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams,
3780
3780
return error (" %s: Consensus::ContextualCheckBlockHeader: %s" , __func__, FormatStateMessage (state));
3781
3781
if (!CheckBlock (block, state, chainparams.GetConsensus (), fCheckPOW , fCheckMerkleRoot ))
3782
3782
return error (" %s: Consensus::CheckBlock: %s" , __func__, FormatStateMessage (state));
3783
- if (!ContextualCheckBlock (block, state, pindexPrev))
3783
+ if (!ContextualCheckBlock (block, state, chainparams. GetConsensus (), pindexPrev))
3784
3784
return error (" %s: Consensus::ContextualCheckBlock: %s" , __func__, FormatStateMessage (state));
3785
3785
if (!ConnectBlock (block, state, &indexDummy, viewNew, chainparams, true ))
3786
3786
return false ;
0 commit comments