@@ -2676,15 +2676,15 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block)
26762676}
26772677
26782678/* * Mark a block as having its data received and checked (up to BLOCK_VALID_TRANSACTIONS). */
2679- bool ReceivedBlockTransactions (const CBlock &block, CValidationState& state, CBlockIndex *pindexNew, const CDiskBlockPos& pos)
2679+ static bool ReceivedBlockTransactions (const CBlock &block, CValidationState& state, CBlockIndex *pindexNew, const CDiskBlockPos& pos, const Consensus::Params& consensusParams )
26802680{
26812681 pindexNew->nTx = block.vtx .size ();
26822682 pindexNew->nChainTx = 0 ;
26832683 pindexNew->nFile = pos.nFile ;
26842684 pindexNew->nDataPos = pos.nPos ;
26852685 pindexNew->nUndoPos = 0 ;
26862686 pindexNew->nStatus |= BLOCK_HAVE_DATA;
2687- if (IsWitnessEnabled (pindexNew->pprev , Params (). GetConsensus () )) {
2687+ if (IsWitnessEnabled (pindexNew->pprev , consensusParams )) {
26882688 pindexNew->nStatus |= BLOCK_OPT_WITNESS;
26892689 }
26902690 pindexNew->RaiseValidity (BLOCK_VALID_TRANSACTIONS);
@@ -3206,7 +3206,7 @@ static bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidation
32063206 if (dbp == NULL )
32073207 if (!WriteBlockToDisk (block, blockPos, chainparams.MessageStart ()))
32083208 AbortNode (state, " Failed to write block" );
3209- if (!ReceivedBlockTransactions (block, state, pindex, blockPos))
3209+ if (!ReceivedBlockTransactions (block, state, pindex, blockPos, chainparams. GetConsensus () ))
32103210 return error (" AcceptBlock(): ReceivedBlockTransactions failed" );
32113211 } catch (const std::runtime_error& e) {
32123212 return AbortNode (state, std::string (" System error: " ) + e.what ());
@@ -3837,7 +3837,7 @@ bool InitBlockIndex(const CChainParams& chainparams)
38373837 if (!WriteBlockToDisk (block, blockPos, chainparams.MessageStart ()))
38383838 return error (" LoadBlockIndex(): writing genesis block to disk failed" );
38393839 CBlockIndex *pindex = AddToBlockIndex (block);
3840- if (!ReceivedBlockTransactions (block, state, pindex, blockPos))
3840+ if (!ReceivedBlockTransactions (block, state, pindex, blockPos, chainparams. GetConsensus () ))
38413841 return error (" LoadBlockIndex(): genesis block not accepted" );
38423842 // Force a chainstate write so that when we VerifyDB in a moment, it doesn't check stale data
38433843 return FlushStateToDisk (state, FLUSH_STATE_ALWAYS);
0 commit comments