Skip to content

Commit

Permalink
txpool: race in logging (#13478)
Browse files Browse the repository at this point in the history
closing #13477
  • Loading branch information
AskAlexSharov authored Jan 17, 2025
1 parent 7f57911 commit a1626f2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions txnprovider/txpool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,6 @@ func (p *TxPool) OnNewBlock(ctx context.Context, stateChanges *remote.StateChang
baseFee := stateChanges.PendingBlockBaseFee
available := len(p.pending.best.ms)

defer func() {
p.logger.Debug("[txpool] New block", "block", block, "unwound", len(unwindTxns.Txns), "mined", len(minedTxns.Txns), "baseFee", baseFee, "pending-pre", available, "pending", p.pending.Len(), "baseFee", p.baseFee.Len(), "queued", p.queued.Len(), "err", err)
}()

if err = minedTxns.Valid(); err != nil {
return err
}
Expand All @@ -332,6 +328,10 @@ func (p *TxPool) OnNewBlock(ctx context.Context, stateChanges *remote.StateChang
p.lock.Unlock()
}()

defer func() {
p.logger.Debug("[txpool] New block", "block", block, "unwound", len(unwindTxns.Txns), "mined", len(minedTxns.Txns), "baseFee", baseFee, "pending-pre", available, "pending", p.pending.Len(), "baseFee", p.baseFee.Len(), "queued", p.queued.Len(), "err", err)
}()

if assert.Enable {
if _, err := kvcache.AssertCheckValues(ctx, coreTx, cache); err != nil {
p.logger.Error("AssertCheckValues", "err", err, "stack", stack.Trace().String())
Expand Down

0 comments on commit a1626f2

Please sign in to comment.