45
45
errTooManyUncles = errors .New ("too many uncles" )
46
46
errInvalidNonce = errors .New ("invalid nonce" )
47
47
errInvalidUncleHash = errors .New ("invalid uncle hash" )
48
+ errInvalidTimestamp = errors .New ("invalid timestamp" )
48
49
)
49
50
50
51
// Beacon is a consensus engine that combines the eth1 consensus and proof-of-stake
@@ -214,7 +215,7 @@ func (beacon *Beacon) VerifyUncles(chain consensus.ChainReader, block *types.Blo
214
215
// - unclehash is expected to be Hash(emptyHeader)
215
216
// to be the desired constants
216
217
//
217
- // (b) the timestamp is not verified anymore
218
+ // (b) we don't verify if a block is in the future anymore
218
219
// (c) the extradata is limited to 32 bytes
219
220
func (beacon * Beacon ) verifyHeader (chain consensus.ChainHeaderReader , header , parent * types.Header ) error {
220
221
// Ensure that the header's extra-data section is of a reasonable size
@@ -228,6 +229,10 @@ func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, pa
228
229
if header .UncleHash != types .EmptyUncleHash {
229
230
return errInvalidUncleHash
230
231
}
232
+ // Verify the timestamp
233
+ if header .Time <= parent .Time {
234
+ return errInvalidTimestamp
235
+ }
231
236
// Verify the block's difficulty to ensure it's the default constant
232
237
if beaconDifficulty .Cmp (header .Difficulty ) != 0 {
233
238
return fmt .Errorf ("invalid difficulty: have %v, want %v" , header .Difficulty , beaconDifficulty )
0 commit comments