Skip to content

Commit

Permalink
add gas tip metrics (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
nibty authored Apr 17, 2024
1 parent cd3a43d commit dd692b0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions evmcore/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ var (
underpricedMinAcceptedPriceTxCounter = metrics.GetOrRegisterMeter("txpool/underpriced/minaccepted", nil)
underpricedRecommendedTipTxCounter = metrics.GetOrRegisterMeter("txpool/underpriced/recommendedtip", nil)
underpricedRecommendedTipAndMinPriceTxCounter = metrics.GetOrRegisterMeter("txpool/underpriced/recommendedtipandminprice", nil)
minPriceGauge = metrics.GetOrRegisterGauge("txpool/minprice", nil)
recommendedTipGauge = metrics.GetOrRegisterGauge("txpool/recommendedtip", nil)

pendingGauge = metrics.GetOrRegisterGauge("txpool/pending", nil)
queuedGauge = metrics.GetOrRegisterGauge("txpool/queued", nil)
Expand Down Expand Up @@ -632,6 +634,8 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
}
// Ensure Opera-specific hard bounds
if recommendedGasTip, minPrice := pool.chain.EffectiveMinTip(), pool.chain.MinGasPrice(); recommendedGasTip != nil && minPrice != nil {
minPriceGauge.Update(minPrice.Int64())
recommendedTipGauge.Update(recommendedGasTip.Int64())
if tx.GasTipCapIntCmp(recommendedGasTip) < 0 {
underpricedRecommendedTipTxCounter.Mark(1)
return ErrUnderpriced
Expand Down

0 comments on commit dd692b0

Please sign in to comment.