@@ -2679,15 +2679,15 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block)
2679
2679
}
2680
2680
2681
2681
/* * Mark a block as having its data received and checked (up to BLOCK_VALID_TRANSACTIONS). */
2682
- bool ReceivedBlockTransactions (const CBlock &block, CValidationState& state, CBlockIndex *pindexNew, const CDiskBlockPos& pos)
2682
+ static bool ReceivedBlockTransactions (const CBlock &block, CValidationState& state, CBlockIndex *pindexNew, const CDiskBlockPos& pos, const Consensus::Params& consensusParams )
2683
2683
{
2684
2684
pindexNew->nTx = block.vtx .size ();
2685
2685
pindexNew->nChainTx = 0 ;
2686
2686
pindexNew->nFile = pos.nFile ;
2687
2687
pindexNew->nDataPos = pos.nPos ;
2688
2688
pindexNew->nUndoPos = 0 ;
2689
2689
pindexNew->nStatus |= BLOCK_HAVE_DATA;
2690
- if (IsWitnessEnabled (pindexNew->pprev , Params (). GetConsensus () )) {
2690
+ if (IsWitnessEnabled (pindexNew->pprev , consensusParams )) {
2691
2691
pindexNew->nStatus |= BLOCK_OPT_WITNESS;
2692
2692
}
2693
2693
pindexNew->RaiseValidity (BLOCK_VALID_TRANSACTIONS);
@@ -3209,7 +3209,7 @@ static bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidation
3209
3209
if (dbp == NULL )
3210
3210
if (!WriteBlockToDisk (block, blockPos, chainparams.MessageStart ()))
3211
3211
AbortNode (state, " Failed to write block" );
3212
- if (!ReceivedBlockTransactions (block, state, pindex, blockPos))
3212
+ if (!ReceivedBlockTransactions (block, state, pindex, blockPos, chainparams. GetConsensus () ))
3213
3213
return error (" AcceptBlock(): ReceivedBlockTransactions failed" );
3214
3214
} catch (const std::runtime_error& e) {
3215
3215
return AbortNode (state, std::string (" System error: " ) + e.what ());
@@ -3840,7 +3840,7 @@ bool InitBlockIndex(const CChainParams& chainparams)
3840
3840
if (!WriteBlockToDisk (block, blockPos, chainparams.MessageStart ()))
3841
3841
return error (" LoadBlockIndex(): writing genesis block to disk failed" );
3842
3842
CBlockIndex *pindex = AddToBlockIndex (block);
3843
- if (!ReceivedBlockTransactions (block, state, pindex, blockPos))
3843
+ if (!ReceivedBlockTransactions (block, state, pindex, blockPos, chainparams. GetConsensus () ))
3844
3844
return error (" LoadBlockIndex(): genesis block not accepted" );
3845
3845
// Force a chainstate write so that when we VerifyDB in a moment, it doesn't check stale data
3846
3846
return FlushStateToDisk (state, FLUSH_STATE_ALWAYS);
0 commit comments