Skip to content

Commit 3a37f22

Browse files
committed
fix(miner): recompute timestamp after sleep
1 parent 50210d9 commit 3a37f22

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

miner/worker.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,12 @@ func (w *worker) commitNewWork() {
732732
return
733733
}
734734

735+
// Recalculate timestamp in case the parent changed while sleeping.
736+
tstart = time.Now()
737+
tstamp = tstart.Unix()
738+
if parent.Time() >= uint64(tstamp) {
739+
tstamp = int64(parent.Time() + 1)
740+
}
735741
num := parent.Number()
736742
header := &types.Header{
737743
ParentHash: parent.Hash(),

0 commit comments

Comments
 (0)