Globals: Make AcceptBlockHeader static (Fix #6163)
..and at the same time prevent AcceptBlockHeader() from calling global function Params()
This commit is contained in:
parent
71cf6ba98b
commit
94debefbcf
|
@ -3897,9 +3897,8 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBlockIndex** ppindex)
|
static bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex=NULL)
|
||||||
{
|
{
|
||||||
const CChainParams& chainparams = Params();
|
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
// Check for duplicate
|
// Check for duplicate
|
||||||
uint256 hash = block.GetHash();
|
uint256 hash = block.GetHash();
|
||||||
|
@ -3948,7 +3947,7 @@ bool AcceptBlock(const CBlock& block, CValidationState& state, CBlockIndex** ppi
|
||||||
|
|
||||||
CBlockIndex *&pindex = *ppindex;
|
CBlockIndex *&pindex = *ppindex;
|
||||||
|
|
||||||
if (!AcceptBlockHeader(block, state, &pindex))
|
if (!AcceptBlockHeader(block, state, chainparams, &pindex))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Try to process all requested blocks that we don't have, but only
|
// Try to process all requested blocks that we don't have, but only
|
||||||
|
@ -5887,7 +5886,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||||
Misbehaving(pfrom->GetId(), 20);
|
Misbehaving(pfrom->GetId(), 20);
|
||||||
return error("non-continuous headers sequence");
|
return error("non-continuous headers sequence");
|
||||||
}
|
}
|
||||||
if (!AcceptBlockHeader(header, state, &pindexLast)) {
|
if (!AcceptBlockHeader(header, state, chainparams, &pindexLast)) {
|
||||||
int nDoS;
|
int nDoS;
|
||||||
if (state.IsInvalid(nDoS)) {
|
if (state.IsInvalid(nDoS)) {
|
||||||
if (nDoS > 0)
|
if (nDoS > 0)
|
||||||
|
|
|
@ -491,7 +491,6 @@ bool TestBlockValidity(CValidationState &state, const CBlock& block, CBlockIndex
|
||||||
* If dbp is non-NULL, the file is known to already reside on disk
|
* If dbp is non-NULL, the file is known to already reside on disk
|
||||||
*/
|
*/
|
||||||
bool AcceptBlock(const CBlock& block, CValidationState& state, CBlockIndex **pindex, bool fRequested, CDiskBlockPos* dbp);
|
bool AcceptBlock(const CBlock& block, CValidationState& state, CBlockIndex **pindex, bool fRequested, CDiskBlockPos* dbp);
|
||||||
bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, CBlockIndex **ppindex= NULL);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue