@@ -1632,15 +1632,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
1632
1632
if ctx .IsSet (CacheNoPrefetchFlag .Name ) {
1633
1633
cfg .NoPrefetch = ctx .Bool (CacheNoPrefetchFlag .Name )
1634
1634
}
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
- }
1644
1635
// Read the value from the flag no matter if it's set or not.
1645
1636
cfg .Preimages = ctx .Bool (CachePreimagesFlag .Name )
1646
1637
if cfg .NoPruning && ! cfg .Preimages {
@@ -1650,6 +1641,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
1650
1641
if ctx .IsSet (StateHistoryFlag .Name ) {
1651
1642
cfg .StateHistory = ctx .Uint64 (StateHistoryFlag .Name )
1652
1643
}
1644
+ if ctx .IsSet (StateSchemeFlag .Name ) {
1645
+ cfg .StateScheme = ctx .String (StateSchemeFlag .Name )
1646
+ }
1653
1647
// Parse transaction history flag, if user is still using legacy config
1654
1648
// file with 'TxLookupLimit' configured, copy the value to 'TransactionHistory'.
1655
1649
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) {
1663
1657
cfg .TransactionHistory = ctx .Uint64 (TxLookupLimitFlag .Name )
1664
1658
}
1665
1659
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 ()
1669
1671
}
1670
1672
if ctx .IsSet (LogHistoryFlag .Name ) {
1671
1673
cfg .LogHistory = ctx .Uint64 (LogHistoryFlag .Name )
@@ -2204,9 +2206,9 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
2204
2206
// Disable transaction indexing/unindexing.
2205
2207
TxLookupLimit : - 1 ,
2206
2208
}
2207
- if options .ArchiveMode && ! options .Preimages && scheme == rawdb . HashScheme {
2209
+ if options .ArchiveMode && ! options .Preimages {
2208
2210
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" )
2210
2212
}
2211
2213
if ! ctx .Bool (SnapshotFlag .Name ) {
2212
2214
options .SnapshotLimit = 0 // Disabled
0 commit comments