fix and add missing parts (this branch as a whole may still be broken)

This commit is contained in:
Jared Wasinger 2024-09-23 21:03:17 +07:00
parent d3a754e735
commit 444599402d
2 changed files with 7 additions and 8 deletions

View file

@ -104,6 +104,12 @@ func New(gasTip uint64, chain BlockChain, subpools []SubPool) (*TxPool, error) {
return pool, nil 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 // 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 // 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 // in time, only a single subpool is able to manage an account, avoiding cross

View file

@ -21,7 +21,6 @@ import (
"crypto/sha256" "crypto/sha256"
"errors" "errors"
"fmt" "fmt"
"math/big"
"sync" "sync"
"time" "time"
@ -34,7 +33,6 @@ import (
"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
) )
@ -286,12 +284,7 @@ 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 c.eth.TxPool().FlushAllTransactions()
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))
} }
// Fork sets the head to the provided hash. // Fork sets the head to the provided hash.