Skip to content

Commit

Permalink
A bit more verbosity for some critical errors (#2316)
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 authored Sep 28, 2018
1 parent a4ff2a1 commit bd8c54d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3297,11 +3297,11 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta

// Check timestamp against prev
if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast())
return state.Invalid(false, REJECT_INVALID, "time-too-old", "block's timestamp is too early");
return state.Invalid(false, REJECT_INVALID, "time-too-old", strprintf("block's timestamp is too early %d %d", block.GetBlockTime(), pindexPrev->GetMedianTimePast()));

// Check timestamp
if (block.GetBlockTime() > nAdjustedTime + 2 * 60 * 60)
return state.Invalid(false, REJECT_INVALID, "time-too-new", "block timestamp too far in the future");
return state.Invalid(false, REJECT_INVALID, "time-too-new", strprintf("block timestamp too far in the future %d %d", block.GetBlockTime(), nAdjustedTime + 2 * 60 * 60));

// check for version 2, 3 and 4 upgrades
if((block.nVersion < 2 && nHeight >= consensusParams.BIP34Height) ||
Expand Down Expand Up @@ -3545,15 +3545,15 @@ bool ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<cons
CheckBlockIndex(chainparams.GetConsensus());
if (!ret) {
GetMainSignals().BlockChecked(*pblock, state);
return error("%s: AcceptBlock FAILED", __func__);
return error("%s: AcceptBlock FAILED: %s", __func__, FormatStateMessage(state));
}
}

NotifyHeaderTip();

CValidationState state; // Only used to report errors, not invalidity - ignore it
if (!ActivateBestChain(state, chainparams, pblock))
return error("%s: ActivateBestChain failed", __func__);
return error("%s: ActivateBestChain failed: %s", __func__, FormatStateMessage(state));

LogPrintf("%s : ACCEPTED\n", __func__);
return true;
Expand Down

0 comments on commit bd8c54d

Please sign in to comment.