Skip to content

Commit d5a8fb6

Browse files
committed
fix
1 parent 3cc09f1 commit d5a8fb6

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

miner/worker.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,6 @@ func (w *worker) mainLoop() {
613613
// be automatically eliminated.
614614
// nolint : nestif
615615
if !w.IsRunning() && w.current != nil {
616-
log.Info("[debug] commiting new work")
617616
// If block is already full, abort
618617
if gp := w.current.gasPool; gp != nil && gp.Gas() < params.TxGas {
619618
continue
@@ -643,17 +642,18 @@ func (w *worker) mainLoop() {
643642

644643
tcount := w.current.tcount
645644

646-
w.interruptCtx = resetAndCopyInterruptCtx(w.interruptCtx)
647-
stopFn := func() {}
648-
if w.interruptCommitFlag {
649-
log.Info("[debug] committing transactions on new tx notif", "delay", delay, "number", w.current.header.Number.Uint64())
650-
// Setting commit interrupt timeout stop execution if it takes longer.
651-
// The number sent is current number - 1 as the log inside getInterruptTimer uses `number+1`.
652-
w.interruptCtx, stopFn = getInterruptTimer(w.interruptCtx, w.current.header.Number.Uint64()-1, w.current.header.Time)
653-
w.interruptCtx = vm.PutCache(w.interruptCtx, w.interruptedTxCache)
654-
}
645+
// w.interruptCtx = resetAndCopyInterruptCtx(w.interruptCtx)
646+
// stopFn := func() {}
647+
// if w.interruptCommitFlag {
648+
// log.Info("[debug] committing transactions on new tx notif", "delay", delay, "number", w.current.header.Number.Uint64())
649+
// Setting commit interrupt timeout stop execution if it takes longer.
650+
// The number sent is current number - 1 as the log inside getInterruptTimer uses `number+1`.
651+
// w.interruptCtx, stopFn = getInterruptTimer(w.interruptCtx, w.current.header.Number.Uint64()-1, w.current.header.Time)
652+
// w.interruptCtx = vm.PutCache(w.interruptCtx, w.interruptedTxCache)
653+
// }
655654
w.commitTransactions(w.current, plainTxs, blobTxs, nil, new(uint256.Int))
656-
stopFn()
655+
// stopFn()
656+
log.Info("[debug] done committing new work in new tx notif channel")
657657

658658
// Only update the snapshot if any new transactons were added
659659
// to the pending block
@@ -1447,9 +1447,8 @@ func (w *worker) commitWork(interrupt *atomic.Int32, noempty bool, timestamp int
14471447
}()
14481448

14491449
if !noempty && w.interruptCommitFlag {
1450-
block := w.chain.GetBlockByHash(w.chain.CurrentBlock().Hash())
1451-
log.Info("[debug] setting interrupt timeout in main loop", "delay", time.Until(time.Unix(int64(work.header.Time), 0)), "block", block.NumberU64())
1452-
w.interruptCtx, stopFn = getInterruptTimer(w.interruptCtx, block.NumberU64(), work.header.Time)
1450+
log.Info("[debug] setting interrupt timeout in main loop", "delay", time.Until(time.Unix(int64(work.header.Time), 0)), "block", work.header.Number.Uint64())
1451+
w.interruptCtx, stopFn = getInterruptTimer(w.interruptCtx, work.header.Number.Uint64(), work.header.Time)
14531452
w.interruptCtx = vm.PutCache(w.interruptCtx, w.interruptedTxCache)
14541453
}
14551454

@@ -1491,6 +1490,7 @@ func (w *worker) commitWork(interrupt *atomic.Int32, noempty bool, timestamp int
14911490
}
14921491
// Submit the generated block for consensus sealing.
14931492
_ = w.commit(work.copy(), w.fullTaskHook, true, start)
1493+
log.Info("[debug] done commiting new work in main loop")
14941494

14951495
// Swap out the old work with the new one, terminating any leftover
14961496
// prefetcher processes in the mean time and starting a new one.
@@ -1524,7 +1524,7 @@ func getInterruptTimer(interruptCtx context.Context, number uint64, timestamp ui
15241524
go func() {
15251525
<-interruptCtx.Done()
15261526
if interruptCtx.Err() != context.Canceled {
1527-
log.Info("Commit Interrupt. Pre-committing the current block", "block", number+1)
1527+
log.Info("Commit Interrupt. Pre-committing the current block", "block", number)
15281528
cancel()
15291529
}
15301530
}()

0 commit comments

Comments
 (0)