mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
eth/catalyst: rework rollback procedure
This commit is contained in:
parent
d71bfff552
commit
e648fb5c55
2 changed files with 8 additions and 4 deletions
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"errors"
|
"errors"
|
||||||
"math"
|
"math"
|
||||||
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -30,6 +31,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/eth"
|
"github.com/ethereum/go-ethereum/eth"
|
||||||
"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"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -282,10 +284,11 @@ 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() {
|
||||||
// TODO (MariusVanDerWijden): implement a way in the transaction pool
|
// Flush all transactions from the transaction pools
|
||||||
// to flush _all_ transactions, even local transactions.
|
c.eth.TxPool().SetGasTip(big.NewInt(-1))
|
||||||
// Since the transactions send via the simulated backend are all
|
// Set the gas tip back to accept new transactions
|
||||||
// send via the RPC, they end up all being local to the node
|
// 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.
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ func New(alloc core.GenesisAlloc, gasLimit uint64) *Backend {
|
||||||
conf := ethconfig.Defaults
|
conf := ethconfig.Defaults
|
||||||
conf.Genesis = &genesis
|
conf.Genesis = &genesis
|
||||||
conf.SyncMode = downloader.FullSync
|
conf.SyncMode = downloader.FullSync
|
||||||
|
conf.TxPool.NoLocals = true
|
||||||
sim, err := newWithNode(stack, &conf, math.MaxUint64)
|
sim, err := newWithNode(stack, &conf, math.MaxUint64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// This should never happen, if it does, please open an issue
|
// This should never happen, if it does, please open an issue
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue