Skip to content

Commit

Permalink
fix and add missing parts (this branch as a whole may still be broken)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwasinger committed Sep 23, 2024
1 parent d3a754e commit 4445994
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 6 additions & 0 deletions core/txpool/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 1 addition & 8 deletions eth/catalyst/simulated_beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"crypto/sha256"
"errors"
"fmt"
"math/big"
"sync"
"time"

Expand All @@ -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"
)

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 4445994

Please sign in to comment.