Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 3,647 Lines • ▼ Show 20 Lines | if (fCheckpointsEnabled) { | ||||
100, | 100, | ||||
error("%s: forked chain older than last checkpoint (height %d)", | error("%s: forked chain older than last checkpoint (height %d)", | ||||
__func__, nHeight), | __func__, nHeight), | ||||
REJECT_CHECKPOINT, "bad-fork-prior-to-checkpoint"); | REJECT_CHECKPOINT, "bad-fork-prior-to-checkpoint"); | ||||
} | } | ||||
} | } | ||||
// Check timestamp against prev | // Check timestamp against prev | ||||
if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast()) { | int64_t tooEarlyTime = pindexPrev->GetMedianTimePast(); | ||||
if (IsPhononEnabled(consensusParams, pindexPrev)) { | |||||
tooEarlyTime = std::max(tooEarlyTime, pindexPrev->GetBlockTime()); | |||||
} | |||||
if (block.GetBlockTime() <= tooEarlyTime) { | |||||
return state.Invalid(false, REJECT_INVALID, "time-too-old", | return state.Invalid(false, REJECT_INVALID, "time-too-old", | ||||
"block's timestamp is too early"); | "block's timestamp is too early"); | ||||
} | } | ||||
// Check timestamp | // Check timestamp | ||||
if (block.GetBlockTime() > nAdjustedTime + MAX_FUTURE_BLOCK_TIME) { | if (block.GetBlockTime() > nAdjustedTime + MAX_FUTURE_BLOCK_TIME) { | ||||
return state.Invalid(false, REJECT_INVALID, "time-too-new", | return state.Invalid(false, REJECT_INVALID, "time-too-new", | ||||
"block timestamp too far in the future"); | "block timestamp too far in the future"); | ||||
▲ Show 20 Lines • Show All 2,037 Lines • Show Last 20 Lines |