diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 17bf438e2a..4f7df3bf4d 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -92,6 +92,7 @@ var ( utils.SyncModeFlag, utils.ExitWhenSyncedFlag, utils.GCModeFlag, + utils.TrieTimeoutFlag, utils.LightServFlag, utils.LightPeersFlag, utils.LightKDFFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 66f533102e..de73e09da8 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -197,6 +197,11 @@ var ( Usage: `Blockchain garbage collection mode ("full", "archive")`, Value: "full", } + TrieTimeoutFlag = cli.DurationFlag{ + Name: "trietimeout", + Usage: `Time limit after which to flush the current in-memory trie to disk (default: 10s)`, + Value: eth.DefaultConfig.TrieTimeout, + } LightServFlag = cli.IntFlag{ Name: "lightserv", Usage: "Maximum percentage of time allowed for serving LES requests (0-90)", @@ -1588,7 +1593,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai Disabled: ctx.GlobalString(GCModeFlag.Name) == "archive", TrieCleanLimit: eth.DefaultConfig.TrieCleanCache, TrieDirtyLimit: eth.DefaultConfig.TrieDirtyCache, - TrieTimeLimit: eth.DefaultConfig.TrieTimeout, + TrieTimeLimit: ctx.GlobalDuration(TrieTimeoutFlag.Name), } if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheTrieFlag.Name) { cache.TrieCleanLimit = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheTrieFlag.Name) / 100