Skip to content

Commit c2147ee

Browse files
authored
eth: don't inadvertently enable snapshots in archive nodes (#21025)
* eth: don't reassign more cache than is being made available * eth: don't inadvertently enable snapshot in a case where --snapshot wasn't given
1 parent b982598 commit c2147ee

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎eth/backend.go‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,12 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
125125
config.Miner.GasPrice = new(big.Int).Set(DefaultConfig.Miner.GasPrice)
126126
}
127127
if config.NoPruning && config.TrieDirtyCache > 0 {
128-
config.TrieCleanCache += config.TrieDirtyCache * 3 / 5
129-
config.SnapshotCache += config.TrieDirtyCache * 3 / 5
128+
if config.SnapshotCache > 0 {
129+
config.TrieCleanCache += config.TrieDirtyCache * 3 / 5
130+
config.SnapshotCache += config.TrieDirtyCache * 2 / 5
131+
} else {
132+
config.TrieCleanCache += config.TrieDirtyCache
133+
}
130134
config.TrieDirtyCache = 0
131135
}
132136
log.Info("Allocated trie memory caches", "clean", common.StorageSize(config.TrieCleanCache)*1024*1024, "dirty", common.StorageSize(config.TrieDirtyCache)*1024*1024)

0 commit comments

Comments
 (0)