fix block time verification

This commit is contained in:
0g-wh 2025-04-22 05:11:27 +00:00
parent cce928eaaf
commit 7bc58427f5
2 changed files with 2 additions and 2 deletions

View file

@ -233,7 +233,7 @@ func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, pa
return errInvalidUncleHash return errInvalidUncleHash
} }
// Verify the timestamp // Verify the timestamp
if header.Time <= parent.Time { if header.Time < parent.Time {
return errInvalidTimestamp return errInvalidTimestamp
} }
// Verify the block's difficulty to ensure it's the default constant // Verify the block's difficulty to ensure it's the default constant

View file

@ -892,7 +892,7 @@ func (api *ConsensusAPI) newPayload(params engine.ExecutableData, versionedHashe
if parent == nil { if parent == nil {
return api.delayPayloadImport(block), nil return api.delayPayloadImport(block), nil
} }
if block.Time() <= parent.Time() { if block.Time() < parent.Time() {
log.Warn("Invalid timestamp", "parent", block.Time(), "block", block.Time()) log.Warn("Invalid timestamp", "parent", block.Time(), "block", block.Time())
return api.invalid(errors.New("invalid timestamp"), parent.Header()), nil return api.invalid(errors.New("invalid timestamp"), parent.Header()), nil
} }