aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-11-11 12:23:27 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-11-11 12:23:33 +0100
commitcb841e75135e97e05cc7e771fb102a08969e2cb4 (patch)
tree50dc3fe6dea9197c6cc23dbdde08e3e00f0c751b
parent38a4f267e82a20b3a5e263ffbf1542140aeef73d (diff)
parent726784374520347f09372532bd89156cdfd950f2 (diff)
Merge pull request #6982
7267843 Globals: Make AcceptBlockHeader static (Fix #6163) (Jorge Timón)
-rw-r--r--src/main.cpp7
-rw-r--r--src/main.h1
2 files changed, 3 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index b8abcff596..8eb8776558 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2791,9 +2791,8 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
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);
// Check for duplicate
uint256 hash = block.GetHash();
@@ -2846,7 +2845,7 @@ bool AcceptBlock(const CBlock& block, CValidationState& state, CBlockIndex** ppi
CBlockIndex *&pindex = *ppindex;
- if (!AcceptBlockHeader(block, state, &pindex))
+ if (!AcceptBlockHeader(block, state, chainparams, &pindex))
return false;
// 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,
Misbehaving(pfrom->GetId(), 20);
return error("non-continuous headers sequence");
}
- if (!AcceptBlockHeader(header, state, &pindexLast)) {
+ if (!AcceptBlockHeader(header, state, chainparams, &pindexLast)) {
int nDoS;
if (state.IsInvalid(nDoS)) {
if (nDoS > 0)
diff --git a/src/main.h b/src/main.h
index a82e3faa45..7a136075ac 100644
--- a/src/main.h
+++ b/src/main.h
@@ -382,7 +382,6 @@ bool TestBlockValidity(CValidationState &state, const CBlock& block, CBlockIndex
/** Store block 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 AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, CBlockIndex **ppindex= NULL);
class CBlockFileInfo