From d7693ce09400afaa881ea10ed913dbc15a469fc3 Mon Sep 17 00:00:00 2001 From: ledgerwatch Date: Fri, 17 Jun 2022 15:46:01 +0100 Subject: [PATCH] [txpool] Prevent clogging up the pending sub pool (#494) * Debug txpool Best * Print Best result * Print * Trace removeMined * Remove mined tx from pending subpool * Remove debug Co-authored-by: Alexey Sharp --- txpool/pool.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/txpool/pool.go b/txpool/pool.go index 410f8d624..8aaa572ae 100644 --- a/txpool/pool.go +++ b/txpool/pool.go @@ -613,15 +613,17 @@ func (p *TxPool) Best(n uint16, txs *types.TxsRlp, tx kv.Tx) error { best := p.pending.best j := 0 for i := 0; j < int(n) && i < len(best.ms); i++ { - if best.ms[i].Tx.Gas >= p.blockGasLimit.Load() { + mt := best.ms[i] + if mt.Tx.Gas >= p.blockGasLimit.Load() { // Skip transactions with very large gas limit continue } - rlpTx, sender, isLocal, err := p.getRlpLocked(tx, best.ms[i].Tx.IDHash[:]) + rlpTx, sender, isLocal, err := p.getRlpLocked(tx, mt.Tx.IDHash[:]) if err != nil { return err } if len(rlpTx) == 0 { + p.pending.Remove(mt) continue } txs.Txs[j] = rlpTx