From 7ab3038951522f260515caa11dc802ed0f032694 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Tue, 19 Dec 2023 13:18:51 +0100 Subject: [PATCH] eth/catalyst: properly flush txs --- core/txpool/legacypool/legacypool.go | 3 +-- eth/catalyst/simulated_beacon.go | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 6c17638319..959e328b9c 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -437,8 +437,7 @@ func (pool *LegacyPool) SetGasTip(tip *big.Int) { pool.gasTip.Store(new(big.Int).Set(tip)) // If the min miner fee increased, remove transactions below the new threshold - // if the new tip is negative, remove all transactions - if tip.Cmp(old) > 0 || tip.Cmp(new(big.Int)) < 0 { + if tip.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 { diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index 5c7971f42a..3a45cd65d9 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -285,7 +285,8 @@ func (c *SimulatedBeacon) Commit() common.Hash { // Rollback un-sends previously added transactions. func (c *SimulatedBeacon) Rollback() { // Flush all transactions from the transaction pools - c.eth.TxPool().SetGasTip(big.NewInt(-1)) + maxUint256 := new(big.Int).Sub(new(big.Int).Lsh(common.Big1, 256), common.Big1) + c.eth.TxPool().SetGasTip(maxUint256) // Set the gas tip back to accept new transactions // TODO (Marius van der Wijden): set gas tip to parameter passed by config c.eth.TxPool().SetGasTip(big.NewInt(params.GWei))