Skip to content

Commit 9779485

Browse files
committed
Revert "cmd: disable preimage in pbss archive"
This reverts commit 11ea6dd. Signed-off-by: Delweng <[email protected]>
1 parent 11ea6dd commit 9779485

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

cmd/utils/flags.go

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,15 +1632,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
16321632
if ctx.IsSet(CacheNoPrefetchFlag.Name) {
16331633
cfg.NoPrefetch = ctx.Bool(CacheNoPrefetchFlag.Name)
16341634
}
1635-
if ctx.IsSet(DataDirFlag.Name) {
1636-
chaindb := tryMakeReadOnlyDatabase(ctx, stack)
1637-
scheme, err := rawdb.ParseStateScheme(ctx.String(StateSchemeFlag.Name), chaindb)
1638-
if err != nil {
1639-
Fatalf("%v", err)
1640-
}
1641-
cfg.StateScheme = scheme
1642-
chaindb.Close()
1643-
}
16441635
// Read the value from the flag no matter if it's set or not.
16451636
cfg.Preimages = ctx.Bool(CachePreimagesFlag.Name)
16461637
if cfg.NoPruning && !cfg.Preimages {
@@ -1650,6 +1641,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
16501641
if ctx.IsSet(StateHistoryFlag.Name) {
16511642
cfg.StateHistory = ctx.Uint64(StateHistoryFlag.Name)
16521643
}
1644+
if ctx.IsSet(StateSchemeFlag.Name) {
1645+
cfg.StateScheme = ctx.String(StateSchemeFlag.Name)
1646+
}
16531647
// Parse transaction history flag, if user is still using legacy config
16541648
// file with 'TxLookupLimit' configured, copy the value to 'TransactionHistory'.
16551649
if cfg.TransactionHistory == ethconfig.Defaults.TransactionHistory && cfg.TxLookupLimit != ethconfig.Defaults.TxLookupLimit {
@@ -1663,9 +1657,17 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
16631657
cfg.TransactionHistory = ctx.Uint64(TxLookupLimitFlag.Name)
16641658
}
16651659

1666-
if ctx.String(GCModeFlag.Name) == "archive" && cfg.TransactionHistory != 0 && cfg.StateScheme == rawdb.HashScheme {
1667-
cfg.TransactionHistory = 0
1668-
log.Warn("Disabled transaction unindexing for archive node with hash state scheme")
1660+
if ctx.String(GCModeFlag.Name) == "archive" && cfg.TransactionHistory != 0 && ctx.IsSet(DataDirFlag.Name) {
1661+
chaindb := tryMakeReadOnlyDatabase(ctx, stack)
1662+
scheme, err := rawdb.ParseStateScheme(cfg.StateScheme, chaindb)
1663+
if err != nil {
1664+
Fatalf("%v", err)
1665+
}
1666+
if scheme == rawdb.HashScheme {
1667+
cfg.TransactionHistory = 0
1668+
log.Warn("Disabled transaction unindexing for archive node with hash state scheme")
1669+
}
1670+
chaindb.Close()
16691671
}
16701672
if ctx.IsSet(LogHistoryFlag.Name) {
16711673
cfg.LogHistory = ctx.Uint64(LogHistoryFlag.Name)
@@ -2204,9 +2206,9 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
22042206
// Disable transaction indexing/unindexing.
22052207
TxLookupLimit: -1,
22062208
}
2207-
if options.ArchiveMode && !options.Preimages && scheme == rawdb.HashScheme {
2209+
if options.ArchiveMode && !options.Preimages {
22082210
options.Preimages = true
2209-
log.Info("Enabling recording of key preimages since archive mode is used in hash state scheme")
2211+
log.Info("Enabling recording of key preimages since archive mode is used")
22102212
}
22112213
if !ctx.Bool(SnapshotFlag.Name) {
22122214
options.SnapshotLimit = 0 // Disabled

0 commit comments

Comments
 (0)