diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2015-12-17 13:45:33 -0500 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2016-02-01 14:29:45 -0500 |
commit | dbb89dc793b0fc19a0d0ac5c4ef08cc2760b06bf (patch) | |
tree | 27a83a6970ff5f7e3a8cd56f6efc49d7b622beb8 | |
parent | 196ad6913ff57cd39caf0b262267e67c5a143467 (diff) |
Eliminate unnecessary call to CheckBlock
ProcessNewBlock would return failure early if CheckBlock failed, before
calling AcceptBlock. AcceptBlock also calls CheckBlock, and upon failure
would update mapBlockIndex to indicate that a block was failed. By returning
early in ProcessNewBlock, we were not marking blocks that fail a check in
CheckBlock as permanently failed, and thus would continue to re-request and
reprocess them.
-rw-r--r-- | src/main.cpp | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index bc7b0daaf9..01d1024b08 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3171,16 +3171,10 @@ static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned bool ProcessNewBlock(CValidationState& state, const CChainParams& chainparams, const CNode* pfrom, const CBlock* pblock, bool fForceProcessing, CDiskBlockPos* dbp) { - // Preliminary checks - bool checked = CheckBlock(*pblock, state); - { LOCK(cs_main); bool fRequested = MarkBlockAsReceived(pblock->GetHash()); fRequested |= fForceProcessing; - if (!checked) { - return error("%s: CheckBlock FAILED %s", __func__, FormatStateMessage(state)); - } // Store to disk CBlockIndex *pindex = NULL; |