Skip to content

Commit cb841e7

Browse files
committed
Merge pull request #6982
7267843 Globals: Make AcceptBlockHeader static (Fix #6163) (Jorge Timón)
2 parents 38a4f26 + 7267843 commit cb841e7

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/main.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,9 +2791,8 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
27912791
return true;
27922792
}
27932793

2794-
bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBlockIndex** ppindex)
2794+
static bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex=NULL)
27952795
{
2796-
const CChainParams& chainparams = Params();
27972796
AssertLockHeld(cs_main);
27982797
// Check for duplicate
27992798
uint256 hash = block.GetHash();
@@ -2846,7 +2845,7 @@ bool AcceptBlock(const CBlock& block, CValidationState& state, CBlockIndex** ppi
28462845

28472846
CBlockIndex *&pindex = *ppindex;
28482847

2849-
if (!AcceptBlockHeader(block, state, &pindex))
2848+
if (!AcceptBlockHeader(block, state, chainparams, &pindex))
28502849
return false;
28512850

28522851
// Try to process all requested blocks that we don't have, but only
@@ -4508,7 +4507,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
45084507
Misbehaving(pfrom->GetId(), 20);
45094508
return error("non-continuous headers sequence");
45104509
}
4511-
if (!AcceptBlockHeader(header, state, &pindexLast)) {
4510+
if (!AcceptBlockHeader(header, state, chainparams, &pindexLast)) {
45124511
int nDoS;
45134512
if (state.IsInvalid(nDoS)) {
45144513
if (nDoS > 0)

src/main.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ bool TestBlockValidity(CValidationState &state, const CBlock& block, CBlockIndex
382382

383383
/** Store block on disk. If dbp is non-NULL, the file is known to already reside on disk */
384384
bool AcceptBlock(const CBlock& block, CValidationState& state, CBlockIndex **pindex, bool fRequested, CDiskBlockPos* dbp);
385-
bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, CBlockIndex **ppindex= NULL);
386385

387386

388387
class CBlockFileInfo

0 commit comments

Comments
 (0)