From 6d77aa90db8ac334123f6fd1066c9b0fc28f7f0a Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Thu, 29 Feb 2024 15:34:48 -0500 Subject: [PATCH] Add tx-pool-lifetime config (10m) (#504) --- core/txpool/txpool.go | 2 +- plugin/evm/config.go | 14 ++++++++------ plugin/evm/vm.go | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index 78f4d986a9..66084299a7 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -209,7 +209,7 @@ var DefaultConfig = Config{ AccountQueue: 64, GlobalQueue: 1024, - Lifetime: 3 * time.Hour, + Lifetime: 10 * time.Minute, } // sanitize checks the provided user configurations and changes anything that's diff --git a/plugin/evm/config.go b/plugin/evm/config.go index 6f14d526ee..772e2b7e60 100644 --- a/plugin/evm/config.go +++ b/plugin/evm/config.go @@ -133,12 +133,13 @@ type Config struct { // API Settings LocalTxsEnabled bool `json:"local-txs-enabled"` - TxPoolPriceLimit uint64 `json:"tx-pool-price-limit"` - TxPoolPriceBump uint64 `json:"tx-pool-price-bump"` - TxPoolAccountSlots uint64 `json:"tx-pool-account-slots"` - TxPoolGlobalSlots uint64 `json:"tx-pool-global-slots"` - TxPoolAccountQueue uint64 `json:"tx-pool-account-queue"` - TxPoolGlobalQueue uint64 `json:"tx-pool-global-queue"` + TxPoolPriceLimit uint64 `json:"tx-pool-price-limit"` + TxPoolPriceBump uint64 `json:"tx-pool-price-bump"` + TxPoolAccountSlots uint64 `json:"tx-pool-account-slots"` + TxPoolGlobalSlots uint64 `json:"tx-pool-global-slots"` + TxPoolAccountQueue uint64 `json:"tx-pool-account-queue"` + TxPoolGlobalQueue uint64 `json:"tx-pool-global-queue"` + TxPoolLifetime Duration `json:"tx-pool-lifetime"` APIMaxDuration Duration `json:"api-max-duration"` WSCPURefillRate Duration `json:"ws-cpu-refill-rate"` @@ -240,6 +241,7 @@ func (c *Config) SetDefaults() { c.TxPoolGlobalSlots = txpool.DefaultConfig.GlobalSlots c.TxPoolAccountQueue = txpool.DefaultConfig.AccountQueue c.TxPoolGlobalQueue = txpool.DefaultConfig.GlobalQueue + c.TxPoolLifetime.Duration = txpool.DefaultConfig.Lifetime c.APIMaxDuration.Duration = defaultApiMaxDuration c.WSCPURefillRate.Duration = defaultWsCpuRefillRate diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index 87f507ffec..52e7bf125a 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -516,6 +516,7 @@ func (vm *VM) Initialize( vm.ethConfig.TxPool.GlobalSlots = vm.config.TxPoolGlobalSlots vm.ethConfig.TxPool.AccountQueue = vm.config.TxPoolAccountQueue vm.ethConfig.TxPool.GlobalQueue = vm.config.TxPoolGlobalQueue + vm.ethConfig.TxPool.Lifetime = vm.config.TxPoolLifetime.Duration vm.ethConfig.AllowUnfinalizedQueries = vm.config.AllowUnfinalizedQueries vm.ethConfig.AllowUnprotectedTxs = vm.config.AllowUnprotectedTxs