@@ -2676,15 +2676,15 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block)
2676
2676
}
2677
2677
2678
2678
/* * 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 )
2680
2680
{
2681
2681
pindexNew->nTx = block.vtx .size ();
2682
2682
pindexNew->nChainTx = 0 ;
2683
2683
pindexNew->nFile = pos.nFile ;
2684
2684
pindexNew->nDataPos = pos.nPos ;
2685
2685
pindexNew->nUndoPos = 0 ;
2686
2686
pindexNew->nStatus |= BLOCK_HAVE_DATA;
2687
- if (IsWitnessEnabled (pindexNew->pprev , Params (). GetConsensus () )) {
2687
+ if (IsWitnessEnabled (pindexNew->pprev , consensusParams )) {
2688
2688
pindexNew->nStatus |= BLOCK_OPT_WITNESS;
2689
2689
}
2690
2690
pindexNew->RaiseValidity (BLOCK_VALID_TRANSACTIONS);
@@ -3206,7 +3206,7 @@ static bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidation
3206
3206
if (dbp == NULL )
3207
3207
if (!WriteBlockToDisk (block, blockPos, chainparams.MessageStart ()))
3208
3208
AbortNode (state, " Failed to write block" );
3209
- if (!ReceivedBlockTransactions (block, state, pindex, blockPos))
3209
+ if (!ReceivedBlockTransactions (block, state, pindex, blockPos, chainparams. GetConsensus () ))
3210
3210
return error (" AcceptBlock(): ReceivedBlockTransactions failed" );
3211
3211
} catch (const std::runtime_error& e) {
3212
3212
return AbortNode (state, std::string (" System error: " ) + e.what ());
@@ -3837,7 +3837,7 @@ bool InitBlockIndex(const CChainParams& chainparams)
3837
3837
if (!WriteBlockToDisk (block, blockPos, chainparams.MessageStart ()))
3838
3838
return error (" LoadBlockIndex(): writing genesis block to disk failed" );
3839
3839
CBlockIndex *pindex = AddToBlockIndex (block);
3840
- if (!ReceivedBlockTransactions (block, state, pindex, blockPos))
3840
+ if (!ReceivedBlockTransactions (block, state, pindex, blockPos, chainparams. GetConsensus () ))
3841
3841
return error (" LoadBlockIndex(): genesis block not accepted" );
3842
3842
// Force a chainstate write so that when we VerifyDB in a moment, it doesn't check stale data
3843
3843
return FlushStateToDisk (state, FLUSH_STATE_ALWAYS);
0 commit comments