Skip to content

Commit

Permalink
miner: interop tx rejected metric, error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
protolambda committed Oct 29, 2024
1 parent a5cc6b0 commit 98b8443
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ var (

txConditionalRejectedCounter = metrics.NewRegisteredCounter("miner/transactionConditional/rejected", nil)
txConditionalMinedTimer = metrics.NewRegisteredTimer("miner/transactionConditional/elapsedtime", nil)

txInteropRejectedCounter = metrics.NewRegisteredCounter("miner/transactionInterop/rejected", nil)
)

// environment is the worker's current environment and holds all
Expand Down Expand Up @@ -444,6 +446,7 @@ func (miner *Miner) checkInterop(ctx context.Context, tx *types.Transaction, rec
if ctx.Err() != nil { // don't reject transactions permanently on RPC timeouts etc.
return err
}
txInteropRejectedCounter.Inc(1)
tx.SetRejected() // Mark the tx as rejected: it will not be welcome in the tx-pool anymore.
return err
}
Expand Down Expand Up @@ -549,6 +552,10 @@ func (miner *Miner) commitTransactions(env *environment, plainTxs, blobTxs *tran
log.Warn("Transaction processing aborted due to RPC context error", "err", err)
return errBlockInterruptedByTimeout // RPC timeout. Tx could not be checked.

case err != nil && tx.Rejected():
log.Warn("Transaction was rejected during block-building", "hash", ltx.Hash, "err", err)
txs.Pop()

case errors.Is(err, nil):
// Everything ok, collect the logs and shift in the next transaction from the same account
txs.Shift()
Expand Down

0 comments on commit 98b8443

Please sign in to comment.