From a5962f1cfde541dae1ea40cd21402e333873eb01 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Mon, 12 Feb 2024 13:26:55 +0100 Subject: [PATCH] core/txpool/legacypool: fix flaw in settip --- core/txpool/legacypool/legacypool.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 4f68de9e1d..275ddda356 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -434,11 +434,13 @@ func (pool *LegacyPool) SetGasTip(tip *big.Int) { pool.mu.Lock() defer pool.mu.Unlock() - newTip := uint256.MustFromBig(tip) + var ( + newTip = uint256.MustFromBig(tip) + old = pool.gasTip.Load() + ) pool.gasTip.Store(newTip) - // If the min miner fee increased, remove transactions below the new threshold - if old := pool.gasTip.Load(); newTip.Cmp(old) > 0 { + if newTip.Cmp(old) > 0 { // pool.priced is sorted by GasFeeCap, so we have to iterate through pool.all instead drop := pool.all.RemotesBelowTip(tip) for _, tx := range drop {