Skip to content

Commit

Permalink
Added a guard on the capacity calc in pool removal
Browse files Browse the repository at this point in the history
  • Loading branch information
kiltsonfire committed May 14, 2024
1 parent cbb8807 commit 1bffe59
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -2102,7 +2102,11 @@ func (pool *TxPool) poolLimiterGoroutine() {
pool.logger.Infof("Queued pool size exceeded limit: %d > %d", queued, pool.config.GlobalQueue)
pool.mu.Lock()
for _, list := range pool.queue {
caps := list.Cap(int(list.Len() - int(pool.config.AccountSlots)))
capacity := int(list.Len() - int(pool.config.AccountQueue))
if capacity < 0 {
capacity = 0
}
caps := list.Cap(capacity)
for _, tx := range caps {
hash := tx.Hash()
pool.all.Remove(hash, pool.logger)
Expand Down

0 comments on commit 1bffe59

Please sign in to comment.