Skip to content

Commit

Permalink
chore!: review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-forbes committed Dec 17, 2023
1 parent 3fcd0eb commit 6cf6d59
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mempool/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const (
FailedAdding = "adding"
FailedRecheck = "recheck"

EvictedTxIncomingFullMempool = "full-removed-incoming"
EvictedTxExistingFullMempool = "full-removed-existing"
EvictedNewTxFullMempool = "full-removed-incoming"
EvictedExistingTxFullMempool = "full-removed-existing"
EvictedTxExpiredBlocks = "expired-ttl-blocks"
EvictedTxExpiredTime = "expired-ttl-time"
)
Expand Down
7 changes: 5 additions & 2 deletions mempool/v1/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ func (txmp *TxMempool) addNewTransaction(wtx *WrappedTx, checkTxRes *abci.Respon
checkTxRes.MempoolError =
fmt.Sprintf("rejected valid incoming transaction; mempool is full (%X)",
wtx.tx.Hash())
txmp.metrics.EvictedTxs.With(mempool.EvictedTxIncomingFullMempool).Add(1)
txmp.metrics.EvictedTxs.With(mempool.EvictedNewTxFullMempool).Add(1)
return
}

Expand Down Expand Up @@ -584,7 +584,7 @@ func (txmp *TxMempool) addNewTransaction(wtx *WrappedTx, checkTxRes *abci.Respon
)
txmp.removeTxByElement(vic)
txmp.cache.Remove(w.tx)
txmp.metrics.EvictedTxs.With(mempool.EvictedTxExistingFullMempool).Add(1)
txmp.metrics.EvictedTxs.With(mempool.EvictedExistingTxFullMempool).Add(1)

// We may not need to evict all the eligible transactions. Bail out
// early if we have made enough room.
Expand Down Expand Up @@ -664,6 +664,9 @@ func (txmp *TxMempool) handleRecheckResult(tx types.Tx, checkTxRes *abci.Respons
txmp.metrics.FailedTxs.With(mempool.FailedRecheck).Add(1)
if !txmp.config.KeepInvalidTxsInCache {
txmp.cache.Remove(wtx.tx)
if err != nil {
schema.WriteMempoolRejected(txmp.traceClient, err.Error())
}
}
txmp.metrics.Size.Set(float64(txmp.Size()))
}
Expand Down

0 comments on commit 6cf6d59

Please sign in to comment.