Skip to content

Commit

Permalink
cmd: enable preimages for archive node
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 committed Nov 13, 2020
1 parent 3f250c3 commit 1772f39
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ var (
}
CachePreimagesFlag = cli.BoolTFlag{
Name: "cache.preimages",
Usage: "Enable recording the SHA3/keccak preimages of trie keys",
Usage: "Enable recording the SHA3/keccak preimages of trie keys (enable by default)",
}
// Miner settings
MiningEnabledFlag = cli.BoolFlag{
Expand Down Expand Up @@ -1533,6 +1533,10 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
// Read the value from the flag no matter it's set or not.
// The default value is true.
cfg.Preimages = ctx.GlobalBool(CachePreimagesFlag.Name)
if cfg.NoPruning && !cfg.Preimages {
cfg.Preimages = true
log.Info("Enable recording the key preimages for archive node")
}
if ctx.GlobalIsSet(TxLookupLimitFlag.Name) {
cfg.TxLookupLimit = ctx.GlobalUint64(TxLookupLimitFlag.Name)
}
Expand Down Expand Up @@ -1844,6 +1848,10 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readOnly bool) (chain *core.B
SnapshotLimit: eth.DefaultConfig.SnapshotCache,
Preimages: ctx.GlobalBool(CachePreimagesFlag.Name),
}
if cache.TrieDirtyDisabled && !cache.Preimages {
cache.Preimages = true
log.Info("Enable recording the key preimages for archive node")
}
if !ctx.GlobalIsSet(SnapshotFlag.Name) {
cache.SnapshotLimit = 0 // Disabled
}
Expand Down

0 comments on commit 1772f39

Please sign in to comment.