@@ -104,6 +104,11 @@ func printHelp(out io.Writer, templ string, data interface{}) {
104
104
w .Flush ()
105
105
}
106
106
107
+ const (
108
+ GCModeFull = "full"
109
+ GCModeArchive = "archive"
110
+ )
111
+
107
112
// These are all the command line flags we support.
108
113
// If you add to this list, please remember to include the
109
114
// flag in the appropriate command definition.
@@ -233,7 +238,7 @@ var (
233
238
GCModeFlag = cli.StringFlag {
234
239
Name : "gcmode" ,
235
240
Usage : `Blockchain garbage collection mode ("full", "archive")` ,
236
- Value : "full" ,
241
+ Value : GCModeArchive ,
237
242
}
238
243
SnapshotFlag = cli.BoolTFlag {
239
244
Name : "snapshot" ,
@@ -432,7 +437,7 @@ var (
432
437
Usage : "Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode)" ,
433
438
Value : 10 ,
434
439
}
435
- CacheNoPrefetchFlag = cli.BoolFlag {
440
+ CacheNoPrefetchFlag = cli.BoolTFlag {
436
441
Name : "cache.noprefetch" ,
437
442
Usage : "Disable heuristic state prefetch during block import (less CPU and disk IO, more time waiting for data)" ,
438
443
}
@@ -1564,7 +1569,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
1564
1569
CheckExclusive (ctx , MainnetFlag , DeveloperFlag , RopstenFlag , RinkebyFlag , GoerliFlag , SepoliaFlag , ScrollAlphaFlag , ScrollSepoliaFlag )
1565
1570
CheckExclusive (ctx , LightServeFlag , SyncModeFlag , "light" )
1566
1571
CheckExclusive (ctx , DeveloperFlag , ExternalSignerFlag ) // Can't use both ephemeral unlocked and external signer
1567
- if ctx .GlobalString (GCModeFlag .Name ) == "archive" && ctx .GlobalUint64 (TxLookupLimitFlag .Name ) != 0 {
1572
+ if ctx .GlobalString (GCModeFlag .Name ) == GCModeArchive && ctx .GlobalUint64 (TxLookupLimitFlag .Name ) != 0 {
1568
1573
ctx .GlobalSet (TxLookupLimitFlag .Name , "0" )
1569
1574
log .Warn ("Disable transaction unindexing for archive node" )
1570
1575
}
@@ -1618,11 +1623,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
1618
1623
cfg .DatabaseFreezer = ctx .GlobalString (AncientFlag .Name )
1619
1624
}
1620
1625
1621
- if gcmode := ctx .GlobalString (GCModeFlag .Name ); gcmode != "full" && gcmode != "archive" {
1626
+ if gcmode := ctx .GlobalString (GCModeFlag .Name ); gcmode != GCModeFull && gcmode != GCModeArchive {
1622
1627
Fatalf ("--%s must be either 'full' or 'archive'" , GCModeFlag .Name )
1623
1628
}
1624
1629
if ctx .GlobalIsSet (GCModeFlag .Name ) {
1625
- cfg .NoPruning = ctx .GlobalString (GCModeFlag .Name ) == "archive"
1630
+ cfg .NoPruning = ctx .GlobalString (GCModeFlag .Name ) == GCModeArchive
1626
1631
}
1627
1632
if ctx .GlobalIsSet (CacheNoPrefetchFlag .Name ) {
1628
1633
cfg .NoPrefetch = ctx .GlobalBool (CacheNoPrefetchFlag .Name )
@@ -1740,6 +1745,15 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
1740
1745
stack .Config ().L1Confirmations = rpc .FinalizedBlockNumber
1741
1746
log .Info ("Setting flag" , "--l1.sync.startblock" , "4038000" )
1742
1747
stack .Config ().L1DeploymentBlock = 4038000
1748
+ // double check correct config
1749
+ if ctx .GlobalString (GCModeFlag .Name ) != GCModeArchive {
1750
+ log .Crit ("Must use --gcmode=archive" )
1751
+ }
1752
+ log .Info ("Setting flag" , "--gcmode" , ctx .GlobalString (GCModeFlag .Name ))
1753
+ if ! ctx .GlobalBool (CacheNoPrefetchFlag .Name ) {
1754
+ log .Crit ("Must use --cache.noprefetch" )
1755
+ }
1756
+ log .Info ("Setting flag" , "--cache.noprefetch" , ctx .GlobalBool (CacheNoPrefetchFlag .Name ))
1743
1757
case ctx .GlobalBool (DeveloperFlag .Name ):
1744
1758
if ! ctx .GlobalIsSet (NetworkIdFlag .Name ) {
1745
1759
cfg .NetworkId = 1337
@@ -2014,14 +2028,14 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
2014
2028
}, nil , false )
2015
2029
}
2016
2030
}
2017
- if gcmode := ctx .GlobalString (GCModeFlag .Name ); gcmode != "full" && gcmode != "archive" {
2031
+ if gcmode := ctx .GlobalString (GCModeFlag .Name ); gcmode != GCModeFull && gcmode != GCModeArchive {
2018
2032
Fatalf ("--%s must be either 'full' or 'archive'" , GCModeFlag .Name )
2019
2033
}
2020
2034
cache := & core.CacheConfig {
2021
2035
TrieCleanLimit : ethconfig .Defaults .TrieCleanCache ,
2022
2036
TrieCleanNoPrefetch : ctx .GlobalBool (CacheNoPrefetchFlag .Name ),
2023
2037
TrieDirtyLimit : ethconfig .Defaults .TrieDirtyCache ,
2024
- TrieDirtyDisabled : ctx .GlobalString (GCModeFlag .Name ) == "archive" ,
2038
+ TrieDirtyDisabled : ctx .GlobalString (GCModeFlag .Name ) == GCModeArchive ,
2025
2039
TrieTimeLimit : ethconfig .Defaults .TrieTimeout ,
2026
2040
SnapshotLimit : ethconfig .Defaults .SnapshotCache ,
2027
2041
Preimages : ctx .GlobalBool (CachePreimagesFlag .Name ),
0 commit comments