Skip to content

Commit c8664ee

Browse files
committed
Trivial: pass Consensus::Params& instead of CChainParams& in ContextualCheckBlock
1 parent 381917f commit c8664ee

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3525,10 +3525,9 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
35253525
return true;
35263526
}
35273527

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)
35293529
{
35303530
const int nHeight = pindexPrev == NULL ? 0 : pindexPrev->nHeight + 1;
3531-
const Consensus::Params& consensusParams = Params().GetConsensus();
35323531

35333532
// Start enforcing BIP113 (Median Time Past) using versionbits logic.
35343533
int nLockTimeFlags = 0;
@@ -3689,7 +3688,8 @@ static bool AcceptBlock(const CBlock& block, CValidationState& state, const CCha
36893688
}
36903689
if (fNewBlock) *fNewBlock = true;
36913690

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)) {
36933693
if (state.IsInvalid() && !state.CorruptionPossible()) {
36943694
pindex->nStatus |= BLOCK_FAILED_VALID;
36953695
setDirtyBlockIndex.insert(pindex);
@@ -3780,7 +3780,7 @@ bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams,
37803780
return error("%s: Consensus::ContextualCheckBlockHeader: %s", __func__, FormatStateMessage(state));
37813781
if (!CheckBlock(block, state, chainparams.GetConsensus(), fCheckPOW, fCheckMerkleRoot))
37823782
return error("%s: Consensus::CheckBlock: %s", __func__, FormatStateMessage(state));
3783-
if (!ContextualCheckBlock(block, state, pindexPrev))
3783+
if (!ContextualCheckBlock(block, state, chainparams.GetConsensus(), pindexPrev))
37843784
return error("%s: Consensus::ContextualCheckBlock: %s", __func__, FormatStateMessage(state));
37853785
if (!ConnectBlock(block, state, &indexDummy, viewNew, chainparams, true))
37863786
return false;

src/main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P
448448
* By "context", we mean only the previous block headers, but not the UTXO
449449
* set; UTXO-related validity checks are done in ConnectBlock(). */
450450
bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev, int64_t nAdjustedTime);
451-
bool ContextualCheckBlock(const CBlock& block, CValidationState& state, const CBlockIndex* pindexPrev);
451+
bool ContextualCheckBlock(const CBlock& block, CValidationState& state, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev);
452452

453453
/** Apply the effects of this block (with given index) on the UTXO set represented by coins.
454454
* Validity checks that depend on the UTXO set are also done; ConnectBlock()

0 commit comments

Comments
 (0)