@@ -383,6 +383,10 @@ var (
383383 Name : "cache.noprefetch" ,
384384 Usage : "Disable heuristic state prefetch during block import (less CPU and disk IO, more time waiting for data)" ,
385385 }
386+ CachePreimagesFlag = cli.BoolTFlag {
387+ Name : "cache.preimages" ,
388+ Usage : "Enable recording the SHA3/keccak preimages of trie keys (default: true)" ,
389+ }
386390 // Miner settings
387391 MiningEnabledFlag = cli.BoolFlag {
388392 Name : "mine" ,
@@ -1526,6 +1530,12 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
15261530 if ctx .GlobalIsSet (CacheNoPrefetchFlag .Name ) {
15271531 cfg .NoPrefetch = ctx .GlobalBool (CacheNoPrefetchFlag .Name )
15281532 }
1533+ // Read the value from the flag no matter if it's set or not.
1534+ cfg .Preimages = ctx .GlobalBool (CachePreimagesFlag .Name )
1535+ if cfg .NoPruning && ! cfg .Preimages {
1536+ cfg .Preimages = true
1537+ log .Info ("Enabling recording of key preimages since archive mode is used" )
1538+ }
15291539 if ctx .GlobalIsSet (TxLookupLimitFlag .Name ) {
15301540 cfg .TxLookupLimit = ctx .GlobalUint64 (TxLookupLimitFlag .Name )
15311541 }
@@ -1835,6 +1845,11 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readOnly bool) (chain *core.B
18351845 TrieDirtyDisabled : ctx .GlobalString (GCModeFlag .Name ) == "archive" ,
18361846 TrieTimeLimit : eth .DefaultConfig .TrieTimeout ,
18371847 SnapshotLimit : eth .DefaultConfig .SnapshotCache ,
1848+ Preimages : ctx .GlobalBool (CachePreimagesFlag .Name ),
1849+ }
1850+ if cache .TrieDirtyDisabled && ! cache .Preimages {
1851+ cache .Preimages = true
1852+ log .Info ("Enabling recording of key preimages since archive mode is used" )
18381853 }
18391854 if ! ctx .GlobalIsSet (SnapshotFlag .Name ) {
18401855 cache .SnapshotLimit = 0 // Disabled
0 commit comments