core/txpool/legacypool: fix flaw in settip

This commit is contained in:
Martin Holst Swende 2024-02-12 13:26:55 +01:00
parent 0099b0523a
commit a5962f1cfd
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0

View file

@ -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 {