Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions sei-tendermint/internal/mempool/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
}

func (txmp *TxMempool) utilisation() float64 {
return float64(txmp.Size()) / float64(txmp.config.Size)
return float64(txmp.NumTxsNotPending()) / float64(txmp.config.Size)

Check notice

Code scanning / CodeQL

Floating point arithmetic Note

Floating point arithmetic operations are not associative and a possible source of non-determinism
}

func (txmp *TxMempool) NumTxsNotPending() int {
Expand Down Expand Up @@ -404,21 +404,23 @@
}

if err == nil {
// Update transaction priority reservoir with the true Tx priority
// as determined by the application.
//
// NOTE: This is done before potentially rejecting the transaction due to
// mempool being full. This is to ensure that the reservoir contains a
// representative sample of all transactions that have been processed by
// CheckTx.
//
// We do not use the priority hint here as it may be misleading and
// inaccurate. The true priority as determined by the application is the
// most accurate.
txmp.priorityReservoir.Add(res.Priority)

// only add new transaction if checkTx passes and is not pending
if !res.IsPendingTransaction {
// Update transaction priority reservoir with the true Tx priority
// as determined by the application.
//
// NOTE: This is done before potentially rejecting the transaction due to
// mempool being full. This is to ensure that the reservoir contains a
// representative sample of all transactions that have been processed by
// CheckTx.
//
// However, this is NOT done if the tx is pending, since a spammer could
// throw off the correct priority percentiles otherwise.
//
// We do not use the priority hint here as it may be misleading and
// inaccurate. The true priority as determined by the application is the
// most accurate.
txmp.priorityReservoir.Add(res.Priority)
err = txmp.addNewTransaction(wtx, res.ResponseCheckTx, txInfo)
if err != nil {
return err
Expand Down
Loading