Skip to content

Commit cfd5f81

Browse files
committed
fix(miner): recompute timestamp after sleep
1 parent b991bd8 commit cfd5f81

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

miner/worker.go

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

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

0 commit comments

Comments
 (0)