aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorJorge Timón <jtimon@jtimon.cc>2015-04-20 00:17:11 +0200
committerJorge Timón <jtimon@jtimon.cc>2015-11-11 13:21:17 +0100
commit598e4945872349ead03ff0cddc87c14b925157ec (patch)
tree24895389627372eadbb9a47e559f596d88cc09c4 /src/main.cpp
parent3ac70609345a249a74fad61b70f93e8a19245011 (diff)
downloadbitcoin-598e4945872349ead03ff0cddc87c14b925157ec.tar.xz
Chainparams: Explicit CChainParams arg for main (pre miner):
-ProcessNewBlock -TestBlockValidity
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 8eb8776558..a71fcff17a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2915,9 +2915,8 @@ static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned
}
-bool ProcessNewBlock(CValidationState &state, const CNode* pfrom, const CBlock* pblock, bool fForceProcessing, CDiskBlockPos *dbp)
+bool ProcessNewBlock(CValidationState& state, const CChainParams& chainparams, const CNode* pfrom, const CBlock* pblock, bool fForceProcessing, CDiskBlockPos* dbp)
{
- const CChainParams& chainparams = Params();
// Preliminary checks
bool checked = CheckBlock(*pblock, state);
@@ -2946,9 +2945,8 @@ bool ProcessNewBlock(CValidationState &state, const CNode* pfrom, const CBlock*
return true;
}
-bool TestBlockValidity(CValidationState &state, const CBlock& block, CBlockIndex * const pindexPrev, bool fCheckPOW, bool fCheckMerkleRoot)
+bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, const CBlock& block, CBlockIndex* pindexPrev, bool fCheckPOW, bool fCheckMerkleRoot)
{
- const CChainParams& chainparams = Params();
AssertLockHeld(cs_main);
assert(pindexPrev && pindexPrev == chainActive.Tip());
if (fCheckpointsEnabled && !CheckIndexAgainstCheckpoint(pindexPrev, state, chainparams, block.GetHash()))
@@ -3488,7 +3486,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
// process in case the block isn't known yet
if (mapBlockIndex.count(hash) == 0 || (mapBlockIndex[hash]->nStatus & BLOCK_HAVE_DATA) == 0) {
CValidationState state;
- if (ProcessNewBlock(state, NULL, &block, true, dbp))
+ if (ProcessNewBlock(state, chainparams, NULL, &block, true, dbp))
nLoaded++;
if (state.IsError())
break;
@@ -3510,7 +3508,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
LogPrintf("%s: Processing out of order child %s of %s\n", __func__, block.GetHash().ToString(),
head.ToString());
CValidationState dummy;
- if (ProcessNewBlock(dummy, NULL, &block, true, &it->second))
+ if (ProcessNewBlock(dummy, chainparams, NULL, &block, true, &it->second))
{
nLoaded++;
queue.push_back(block.GetHash());
@@ -4547,7 +4545,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// Such an unrequested block may still be processed, subject to the
// conditions in AcceptBlock().
bool forceProcessing = pfrom->fWhitelisted && !IsInitialBlockDownload();
- ProcessNewBlock(state, pfrom, &block, forceProcessing, NULL);
+ ProcessNewBlock(state, chainparams, pfrom, &block, forceProcessing, NULL);
int nDoS;
if (state.IsInvalid(nDoS)) {
assert (state.GetRejectCode() < REJECT_INTERNAL); // Blocks are never rejected with internal reject codes