Skip to content

Commit

Permalink
eth: don't inadvertently enable snapshots in archive nodes (ethereum#…
Browse files Browse the repository at this point in the history
…21025)

Cherry-pick of c2147ee from upstream.

* 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
  • Loading branch information
ploui authored and Or Neeman committed Dec 2, 2020
1 parent c2789c8 commit 8924d6c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,12 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
config.Miner.GasPrice = new(big.Int).Set(DefaultConfig.Miner.GasPrice)
}
if config.NoPruning && config.TrieDirtyCache > 0 {
config.TrieCleanCache += config.TrieDirtyCache * 3 / 5
config.SnapshotCache += config.TrieDirtyCache * 3 / 5
if config.SnapshotCache > 0 {
config.TrieCleanCache += config.TrieDirtyCache * 3 / 5
config.SnapshotCache += config.TrieDirtyCache * 2 / 5
} else {
config.TrieCleanCache += config.TrieDirtyCache
}
config.TrieDirtyCache = 0
}
log.Info("Allocated trie memory caches", "clean", common.StorageSize(config.TrieCleanCache)*1024*1024, "dirty", common.StorageSize(config.TrieDirtyCache)*1024*1024)
Expand Down

0 comments on commit 8924d6c

Please sign in to comment.