浏览代码

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
Péter Szilágyi 5 年之前
父节点
当前提交
68754f3931
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. 1 0
      cmd/utils/flags.go
  2. 2 2
      eth/config.go

+ 1 - 0
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
 		cfg.SnapshotCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheSnapshotFlag.Name) / 100
 	}
 	}
 	if !ctx.GlobalIsSet(SnapshotFlag.Name) {
 	if !ctx.GlobalIsSet(SnapshotFlag.Name) {
+		cfg.TrieCleanCache += cfg.SnapshotCache
 		cfg.SnapshotCache = 0 // Disabled
 		cfg.SnapshotCache = 0 // Disabled
 	}
 	}
 	if ctx.GlobalIsSet(DocRootFlag.Name) {
 	if ctx.GlobalIsSet(DocRootFlag.Name) {

+ 2 - 2
eth/config.go

@@ -61,12 +61,12 @@ var DefaultConfig = Config{
 	LightPeers:              100,
 	LightPeers:              100,
 	UltraLightFraction:      75,
 	UltraLightFraction:      75,
 	DatabaseCache:           512,
 	DatabaseCache:           512,
-	TrieCleanCache:          256,
+	TrieCleanCache:          154,
 	TrieCleanCacheJournal:   "triecache",
 	TrieCleanCacheJournal:   "triecache",
 	TrieCleanCacheRejournal: 60 * time.Minute,
 	TrieCleanCacheRejournal: 60 * time.Minute,
 	TrieDirtyCache:          256,
 	TrieDirtyCache:          256,
 	TrieTimeout:             60 * time.Minute,
 	TrieTimeout:             60 * time.Minute,
-	SnapshotCache:           256,
+	SnapshotCache:           102,
 	Miner: miner.Config{
 	Miner: miner.Config{
 		GasFloor: 8000000,
 		GasFloor: 8000000,
 		GasCeil:  8000000,
 		GasCeil:  8000000,