Move check for block times that are too far ahead of adjusted time, to ContextualCheckBlock.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
b8ca7131c7
commit
df6b4639d2
10
src/main.cpp
10
src/main.cpp
|
@ -3692,11 +3692,6 @@ bool CheckBlockHeader(
|
|||
return state.DoS(50, error("CheckBlockHeader(): proof of work failed"),
|
||||
REJECT_INVALID, "high-hash");
|
||||
|
||||
// Check timestamp
|
||||
if (block.GetBlockTime() > GetAdjustedTime() + 2 * 60 * 60)
|
||||
return state.Invalid(error("CheckBlockHeader(): block timestamp too far in the future"),
|
||||
REJECT_INVALID, "time-too-new");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3786,6 +3781,11 @@ bool ContextualCheckBlockHeader(
|
|||
return state.Invalid(error("%s: block's timestamp is too early", __func__),
|
||||
REJECT_INVALID, "time-too-old");
|
||||
|
||||
// Check timestamp
|
||||
if (block.GetBlockTime() > GetAdjustedTime() + 2 * 60 * 60)
|
||||
return state.Invalid(error("%s: block timestamp too far in the future", __func__),
|
||||
REJECT_INVALID, "time-too-new");
|
||||
|
||||
if (fCheckpointsEnabled)
|
||||
{
|
||||
// Don't accept any forks from the main chain prior to last checkpoint
|
||||
|
|
Loading…
Reference in New Issue