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
12 changes: 8 additions & 4 deletions mempool/clist_mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,10 +706,6 @@ func (mem *CListMempool) purgeExpiredTxs(blockHeight int64, blockTime time.Time)
func (mem *CListMempool) recheckTxs() {
mem.logger.Debug("recheck txs", "height", mem.height.Load(), "num-txs", mem.Size())

if mem.Size() <= 0 {
return
}

for e := mem.txs.Front(); e != nil; e = e.Next() {
memTx := e.Value.(*mempoolTx)
// If this transaction is Cosmos transaction containing a
Expand All @@ -721,6 +717,14 @@ func (mem *CListMempool) recheckTxs() {
}
}
}

// If the mempool is empty after removing short-term CLOB transactions, there will be no
// recheck responses sent by the app, so waiting on mem.recheck.doneRechecking() would
// block until mem.config.RecheckTimeout elapses. Early-return here avoids that idle wait.
if mem.Size() <= 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could you add a quick comment on why it's important to early return here when mem.Size() is 0/

return
}

mem.recheck.init(mem.txs.Front(), mem.txs.Back())

// NOTE: globalCb may be called concurrently, but CheckTx cannot be executed concurrently
Expand Down
Loading