Skip to content

Commit dbb89dc

Browse files
committed
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.
1 parent 196ad69 commit dbb89dc

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/main.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3171,16 +3171,10 @@ static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned
31713171

31723172
bool ProcessNewBlock(CValidationState& state, const CChainParams& chainparams, const CNode* pfrom, const CBlock* pblock, bool fForceProcessing, CDiskBlockPos* dbp)
31733173
{
3174-
// Preliminary checks
3175-
bool checked = CheckBlock(*pblock, state);
3176-
31773174
{
31783175
LOCK(cs_main);
31793176
bool fRequested = MarkBlockAsReceived(pblock->GetHash());
31803177
fRequested |= fForceProcessing;
3181-
if (!checked) {
3182-
return error("%s: CheckBlock FAILED %s", __func__, FormatStateMessage(state));
3183-
}
31843178

31853179
// Store to disk
31863180
CBlockIndex *pindex = NULL;

0 commit comments

Comments
 (0)