From 444599402da1a9cba228a718fcdb967f5109e4fc Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Mon, 23 Sep 2024 21:03:17 +0700 Subject: [PATCH] fix and add missing parts (this branch as a whole may still be broken) --- core/txpool/txpool.go | 6 ++++++ eth/catalyst/simulated_beacon.go | 9 +-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index be7435247d..20b777c25d 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -104,6 +104,12 @@ func New(gasTip uint64, chain BlockChain, subpools []SubPool) (*TxPool, error) { return pool, nil } +func (p *TxPool) FlushAllTransactions() { + for _, subpool := range p.subpools { + subpool.FlushAllTransactions() + } +} + // reserver is a method to create an address reservation callback to exclusively // assign/deassign addresses to/from subpools. This can ensure that at any point // in time, only a single subpool is able to manage an account, avoiding cross diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index cb27810aac..bfcc4d5a5a 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -21,7 +21,6 @@ import ( "crypto/sha256" "errors" "fmt" - "math/big" "sync" "time" @@ -34,7 +33,6 @@ import ( "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" ) @@ -286,12 +284,7 @@ func (c *SimulatedBeacon) Commit() common.Hash { // Rollback un-sends previously added transactions. func (c *SimulatedBeacon) Rollback() { - // Flush all transactions from the transaction pools - 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)) + c.eth.TxPool().FlushAllTransactions() } // Fork sets the head to the provided hash.