Skip to content

Commit 1772f39

Browse files
committed
cmd: enable preimages for archive node
1 parent 3f250c3 commit 1772f39

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmd/utils/flags.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ var (
385385
}
386386
CachePreimagesFlag = cli.BoolTFlag{
387387
Name: "cache.preimages",
388-
Usage: "Enable recording the SHA3/keccak preimages of trie keys",
388+
Usage: "Enable recording the SHA3/keccak preimages of trie keys (enable by default)",
389389
}
390390
// Miner settings
391391
MiningEnabledFlag = cli.BoolFlag{
@@ -1533,6 +1533,10 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
15331533
// Read the value from the flag no matter it's set or not.
15341534
// The default value is true.
15351535
cfg.Preimages = ctx.GlobalBool(CachePreimagesFlag.Name)
1536+
if cfg.NoPruning && !cfg.Preimages {
1537+
cfg.Preimages = true
1538+
log.Info("Enable recording the key preimages for archive node")
1539+
}
15361540
if ctx.GlobalIsSet(TxLookupLimitFlag.Name) {
15371541
cfg.TxLookupLimit = ctx.GlobalUint64(TxLookupLimitFlag.Name)
15381542
}
@@ -1844,6 +1848,10 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readOnly bool) (chain *core.B
18441848
SnapshotLimit: eth.DefaultConfig.SnapshotCache,
18451849
Preimages: ctx.GlobalBool(CachePreimagesFlag.Name),
18461850
}
1851+
if cache.TrieDirtyDisabled && !cache.Preimages {
1852+
cache.Preimages = true
1853+
log.Info("Enable recording the key preimages for archive node")
1854+
}
18471855
if !ctx.GlobalIsSet(SnapshotFlag.Name) {
18481856
cache.SnapshotLimit = 0 // Disabled
18491857
}

0 commit comments

Comments
 (0)