Skip to content

Commit a6548a4

Browse files
committed
Merge #10201: pass Consensus::Params& to ReceivedBlockTransactions()
25660e9 pass Consensus::Params& to ReceivedBlockTransactions() (Mario Dian) Tree-SHA512: d3a5b19d93313e4bda622b322bc9cbfb7e31486010eac40fca6eea9703f814f9667f778122ba7366bb304482a2c03e2e3325083beecac374751692361952e467
2 parents 1428f30 + 25660e9 commit a6548a4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/validation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,15 +2679,15 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block)
26792679
}
26802680

26812681
/** 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)
26832683
{
26842684
pindexNew->nTx = block.vtx.size();
26852685
pindexNew->nChainTx = 0;
26862686
pindexNew->nFile = pos.nFile;
26872687
pindexNew->nDataPos = pos.nPos;
26882688
pindexNew->nUndoPos = 0;
26892689
pindexNew->nStatus |= BLOCK_HAVE_DATA;
2690-
if (IsWitnessEnabled(pindexNew->pprev, Params().GetConsensus())) {
2690+
if (IsWitnessEnabled(pindexNew->pprev, consensusParams)) {
26912691
pindexNew->nStatus |= BLOCK_OPT_WITNESS;
26922692
}
26932693
pindexNew->RaiseValidity(BLOCK_VALID_TRANSACTIONS);
@@ -3209,7 +3209,7 @@ static bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidation
32093209
if (dbp == NULL)
32103210
if (!WriteBlockToDisk(block, blockPos, chainparams.MessageStart()))
32113211
AbortNode(state, "Failed to write block");
3212-
if (!ReceivedBlockTransactions(block, state, pindex, blockPos))
3212+
if (!ReceivedBlockTransactions(block, state, pindex, blockPos, chainparams.GetConsensus()))
32133213
return error("AcceptBlock(): ReceivedBlockTransactions failed");
32143214
} catch (const std::runtime_error& e) {
32153215
return AbortNode(state, std::string("System error: ") + e.what());
@@ -3840,7 +3840,7 @@ bool InitBlockIndex(const CChainParams& chainparams)
38403840
if (!WriteBlockToDisk(block, blockPos, chainparams.MessageStart()))
38413841
return error("LoadBlockIndex(): writing genesis block to disk failed");
38423842
CBlockIndex *pindex = AddToBlockIndex(block);
3843-
if (!ReceivedBlockTransactions(block, state, pindex, blockPos))
3843+
if (!ReceivedBlockTransactions(block, state, pindex, blockPos, chainparams.GetConsensus()))
38443844
return error("LoadBlockIndex(): genesis block not accepted");
38453845
// Force a chainstate write so that when we VerifyDB in a moment, it doesn't check stale data
38463846
return FlushStateToDisk(state, FLUSH_STATE_ALWAYS);

0 commit comments

Comments
 (0)