From 1bffe59137b3e1b7a7a0c6230131e1ea1cd2ad3d Mon Sep 17 00:00:00 2001 From: drk Date: Mon, 13 May 2024 22:23:00 -0500 Subject: [PATCH] Added a guard on the capacity calc in pool removal --- core/tx_pool.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/tx_pool.go b/core/tx_pool.go index 38952d55b8..4241d2f140 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -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)