mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd, eth: Add txpool.disabled flag
This commit is contained in:
parent
ffc6a0f36e
commit
320ca209e0
6 changed files with 39 additions and 12 deletions
|
|
@ -164,6 +164,10 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
|
|||
}
|
||||
applyMetricConfig(ctx, &cfg)
|
||||
|
||||
if cfg.Eth.TxPoolDisabled && cfg.Node.P2P.NetRestrict == nil {
|
||||
utils.Fatalf("Transaction pool can only be disabled when network is restricted")
|
||||
}
|
||||
|
||||
return stack, cfg
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ var (
|
|||
utils.OverrideCancun,
|
||||
utils.OverrideVerkle,
|
||||
utils.EnablePersonal,
|
||||
utils.TxPoolDisabledFlag,
|
||||
utils.TxPoolLocalsFlag,
|
||||
utils.TxPoolNoLocalsFlag,
|
||||
utils.TxPoolJournalFlag,
|
||||
|
|
|
|||
|
|
@ -318,6 +318,11 @@ var (
|
|||
Category: flags.LightCategory,
|
||||
}
|
||||
// Transaction pool settings
|
||||
TxPoolDisabledFlag = &cli.BoolFlag{
|
||||
Name: "txpool.disabled",
|
||||
Usage: "Run node without a transaction pool",
|
||||
Category: flags.TxPoolCategory,
|
||||
}
|
||||
TxPoolLocalsFlag = &cli.StringFlag{
|
||||
Name: "txpool.locals",
|
||||
Usage: "Comma separated accounts to treat as locals (no flush, priority inclusion)",
|
||||
|
|
@ -1656,11 +1661,16 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
|||
// Set configurations from CLI flags
|
||||
setEtherbase(ctx, cfg)
|
||||
setGPO(ctx, &cfg.GPO, ctx.String(SyncModeFlag.Name) == "light")
|
||||
setTxPool(ctx, &cfg.TxPool)
|
||||
setMiner(ctx, &cfg.Miner)
|
||||
setRequiredBlocks(ctx, cfg)
|
||||
setLes(ctx, cfg)
|
||||
|
||||
if ctx.IsSet(TxPoolDisabledFlag.Name) {
|
||||
cfg.TxPoolDisabled = ctx.Bool(TxPoolDisabledFlag.Name)
|
||||
} else {
|
||||
setTxPool(ctx, &cfg.TxPool)
|
||||
}
|
||||
|
||||
// Cap the cache allowance and tune the garbage collector
|
||||
mem, err := gopsutil.VirtualMemory()
|
||||
if err == nil {
|
||||
|
|
|
|||
|
|
@ -215,6 +215,8 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
|||
}
|
||||
eth.bloomIndexer.Start(eth.blockchain)
|
||||
|
||||
var subpools []txpool.SubPool
|
||||
if !config.TxPoolDisabled {
|
||||
if config.BlobPool.Datadir != "" {
|
||||
config.BlobPool.Datadir = stack.ResolvePath(config.BlobPool.Datadir)
|
||||
}
|
||||
|
|
@ -225,7 +227,9 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
|||
}
|
||||
legacyPool := legacypool.New(config.TxPool, eth.blockchain)
|
||||
|
||||
eth.txPool, err = txpool.New(new(big.Int).SetUint64(config.TxPool.PriceLimit), eth.blockchain, []txpool.SubPool{legacyPool, blobPool})
|
||||
subpools = []txpool.SubPool{legacyPool, blobPool}
|
||||
}
|
||||
eth.txPool, err = txpool.New(new(big.Int).SetUint64(config.TxPool.PriceLimit), eth.blockchain, subpools)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ var Defaults = Config{
|
|||
SnapshotCache: 102,
|
||||
FilterLogCacheSize: 32,
|
||||
Miner: miner.DefaultConfig,
|
||||
TxPoolDisabled: false,
|
||||
TxPool: legacypool.DefaultConfig,
|
||||
BlobPool: blobpool.DefaultConfig,
|
||||
RPCGasCap: 50000000,
|
||||
|
|
@ -141,6 +142,7 @@ type Config struct {
|
|||
Miner miner.Config
|
||||
|
||||
// Transaction pool options
|
||||
TxPoolDisabled bool
|
||||
TxPool legacypool.Config
|
||||
BlobPool blobpool.Config
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
|
|||
Preimages bool
|
||||
FilterLogCacheSize int
|
||||
Miner miner.Config
|
||||
TxPoolDisabled bool
|
||||
TxPool legacypool.Config
|
||||
BlobPool blobpool.Config
|
||||
GPO gasprice.Config
|
||||
|
|
@ -87,6 +88,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
|
|||
enc.Preimages = c.Preimages
|
||||
enc.FilterLogCacheSize = c.FilterLogCacheSize
|
||||
enc.Miner = c.Miner
|
||||
enc.TxPoolDisabled = c.TxPoolDisabled
|
||||
enc.TxPool = c.TxPool
|
||||
enc.BlobPool = c.BlobPool
|
||||
enc.GPO = c.GPO
|
||||
|
|
@ -132,6 +134,7 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
|
|||
Preimages *bool
|
||||
FilterLogCacheSize *int
|
||||
Miner *miner.Config
|
||||
TxPoolDisabled *bool
|
||||
TxPool *legacypool.Config
|
||||
BlobPool *blobpool.Config
|
||||
GPO *gasprice.Config
|
||||
|
|
@ -234,6 +237,9 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
|
|||
if dec.Miner != nil {
|
||||
c.Miner = *dec.Miner
|
||||
}
|
||||
if dec.TxPoolDisabled != nil {
|
||||
c.TxPoolDisabled = *dec.TxPoolDisabled
|
||||
}
|
||||
if dec.TxPool != nil {
|
||||
c.TxPool = *dec.TxPool
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue