From 68754f393184b3fa1402f00da2d3b65502dcbc69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Thu, 6 Aug 2020 15:28:31 +0300 Subject: [PATCH] cmd/utils: grant snapshot cache to trie if disabled (#21416) * cmd/utils: grant snapshot cache to trie if disabled * eth: fix up default non-mainnet cache distribution --- cmd/utils/flags.go | 1 + eth/config.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index a2e5244dc4..403888c12f 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1542,6 +1542,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { cfg.SnapshotCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheSnapshotFlag.Name) / 100 } if !ctx.GlobalIsSet(SnapshotFlag.Name) { + cfg.TrieCleanCache += cfg.SnapshotCache cfg.SnapshotCache = 0 // Disabled } if ctx.GlobalIsSet(DocRootFlag.Name) { diff --git a/eth/config.go b/eth/config.go index 506a0ad041..1074e5a371 100644 --- a/eth/config.go +++ b/eth/config.go @@ -61,12 +61,12 @@ var DefaultConfig = Config{ LightPeers: 100, UltraLightFraction: 75, DatabaseCache: 512, - TrieCleanCache: 256, + TrieCleanCache: 154, TrieCleanCacheJournal: "triecache", TrieCleanCacheRejournal: 60 * time.Minute, TrieDirtyCache: 256, TrieTimeout: 60 * time.Minute, - SnapshotCache: 256, + SnapshotCache: 102, Miner: miner.Config{ GasFloor: 8000000, GasCeil: 8000000,