fix(miner): recompute timestamp after sleep (#2052)

This commit is contained in:
Daniel Liu 2026-03-11 09:57:06 +08:00 committed by GitHub
parent 338d1b4632
commit ae6da0583f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -780,6 +780,11 @@ func (w *worker) commitNewWork() {
return
}
// Recalculate timestamp in case the parent changed while sleeping.
tstamp = time.Now().Unix()
if parent.Time() >= uint64(tstamp) {
tstamp = int64(parent.Time() + 1)
}
num := parent.Number()
header := &types.Header{
ParentHash: parent.Hash(),