Skip to content

Commit

Permalink
worker: add debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
manav2401 committed Feb 23, 2024
1 parent 050dace commit 8efc16f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ func (w *worker) newWorkLoop(ctx context.Context, recommit time.Duration) {
interrupt.Store(s)
}

log.Info("[sync debug] worker.newWorkLoop: about to commit")
log.Info("[sync debug] worker.newWorkLoop: about to commit", "len", len(w.newWorkCh))
interrupt = new(atomic.Int32)
select {
case w.newWorkCh <- &newWorkReq{interrupt: interrupt, timestamp: timestamp, ctx: ctx, noempty: noempty}:
Expand Down Expand Up @@ -565,6 +565,7 @@ func (w *worker) newWorkLoop(ctx context.Context, recommit time.Duration) {
}

case adjust := <-w.resubmitAdjustCh:
log.Info("[sync debug] worker.newWorkLoop: received resubmit adjustment", "len", len(w.resubmitAdjustCh))
// Adjust resubmit interval by feedback.
if adjust.inc {
before := recommit
Expand Down Expand Up @@ -604,7 +605,7 @@ func (w *worker) mainLoop(ctx context.Context) {
for {
select {
case req := <-w.newWorkCh:
log.Info("[sync debug] worker.mainLoop: received new work request")
log.Info("[sync debug] worker.mainLoop: received new work request", "len", len(w.newWorkCh))
if w.chainConfig.ChainID.Cmp(params.BorMainnetChainConfig.ChainID) == 0 || w.chainConfig.ChainID.Cmp(params.MumbaiChainConfig.ChainID) == 0 {
if w.eth.PeerCount() > 0 {
//nolint:contextcheck
Expand Down Expand Up @@ -1611,8 +1612,8 @@ func (w *worker) commitWork(ctx context.Context, interrupt *atomic.Int32, noempt
case err == nil:
// The entire block is filled, decrease resubmit interval in case
// of current interval is larger than the user-specified one.
log.Info("[sync debug] worker.commitWork: sending to resubmitAdjustCh", "len", len(w.resubmitAdjustCh))
w.resubmitAdjustCh <- &intervalAdjust{inc: false}
log.Info("[sync debug] worker.commitWork: done sending to resubmitAdjustCh")

case errors.Is(err, errBlockInterruptedByRecommit):
// Notify resubmit loop to increase resubmitting interval if the
Expand Down Expand Up @@ -1645,6 +1646,8 @@ func (w *worker) commitWork(ctx context.Context, interrupt *atomic.Int32, noempt
w.current.discard()
}

log.Info("[sync debug] worker.commitWork: exiting from commitWork", "number", work.header.Number.Uint64())

w.current = work
}

Expand Down

0 comments on commit 8efc16f

Please sign in to comment.