Skip to content

Commit

Permalink
core/txpool/legacypool: fix flaw in settip
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Feb 12, 2024
1 parent 0099b05 commit a5962f1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/txpool/legacypool/legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a5962f1

Please sign in to comment.