eth/catalyst: properly flush txs

This commit is contained in:
Marius van der Wijden 2023-12-19 13:18:51 +01:00
parent c557960303
commit 7ab3038951
2 changed files with 3 additions and 3 deletions

View file

@ -437,8 +437,7 @@ func (pool *LegacyPool) SetGasTip(tip *big.Int) {
pool.gasTip.Store(new(big.Int).Set(tip)) pool.gasTip.Store(new(big.Int).Set(tip))
// If the min miner fee increased, remove transactions below the new threshold // 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 {
if tip.Cmp(old) > 0 || tip.Cmp(new(big.Int)) < 0 {
// pool.priced is sorted by GasFeeCap, so we have to iterate through pool.all instead // pool.priced is sorted by GasFeeCap, so we have to iterate through pool.all instead
drop := pool.all.RemotesBelowTip(tip) drop := pool.all.RemotesBelowTip(tip)
for _, tx := range drop { for _, tx := range drop {

View file

@ -285,7 +285,8 @@ func (c *SimulatedBeacon) Commit() common.Hash {
// Rollback un-sends previously added transactions. // Rollback un-sends previously added transactions.
func (c *SimulatedBeacon) Rollback() { func (c *SimulatedBeacon) Rollback() {
// Flush all transactions from the transaction pools // 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 // Set the gas tip back to accept new transactions
// TODO (Marius van der Wijden): set gas tip to parameter passed by config // TODO (Marius van der Wijden): set gas tip to parameter passed by config
c.eth.TxPool().SetGasTip(big.NewInt(params.GWei)) c.eth.TxPool().SetGasTip(big.NewInt(params.GWei))