A bit more verbosity for some critical errors (#2316)

This commit is contained in:
UdjinM6 2018-09-28 10:55:30 +03:00 committed by GitHub
parent a4ff2a19a7
commit bd8c54d12e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) ||
@ -3545,7 +3545,7 @@ 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));
}
}
@ -3553,7 +3553,7 @@ bool ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<cons
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;