Skip to content

Commit

Permalink
cmd: remove deprecated flags --fast and --light
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed Feb 21, 2025
1 parent 2f62656 commit ab697ec
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 32 deletions.
11 changes: 5 additions & 6 deletions cmd/XDC/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ var (
Flags: []cli.Flag{
utils.DataDirFlag,
utils.XDCXDataDirFlag,
utils.LightModeFlag,
utils.MainnetFlag,
utils.TestnetFlag,
utils.DevnetFlag,
Expand All @@ -65,7 +64,7 @@ It expects the genesis file or the network name [ mainnet | testnet | devnet ] a
utils.DataDirFlag,
utils.XDCXDataDirFlag,
utils.CacheFlag,
utils.LightModeFlag,
utils.SyncModeFlag,
utils.GCModeFlag,
utils.CacheDatabaseFlag,
utils.CacheGCFlag,
Expand Down Expand Up @@ -98,7 +97,7 @@ processing will proceed even if an individual RLP-file import failure occurs.`,
utils.DataDirFlag,
utils.XDCXDataDirFlag,
utils.CacheFlag,
utils.LightModeFlag,
utils.SyncModeFlag,
},
Description: `
Requires a first argument of the file to write to.
Expand All @@ -115,7 +114,7 @@ if already existing.`,
utils.DataDirFlag,
utils.XDCXDataDirFlag,
utils.CacheFlag,
utils.LightModeFlag,
utils.SyncModeFlag,
},
Category: "BLOCKCHAIN COMMANDS",
Description: `
Expand All @@ -130,7 +129,7 @@ if already existing.`,
utils.DataDirFlag,
utils.XDCXDataDirFlag,
utils.CacheFlag,
utils.LightModeFlag,
utils.SyncModeFlag,
},
Description: `
The export-preimages command export hash preimages to an RLP encoded stream`,
Expand All @@ -144,7 +143,7 @@ The export-preimages command export hash preimages to an RLP encoded stream`,
utils.DataDirFlag,
utils.XDCXDataDirFlag,
utils.CacheFlag,
utils.LightModeFlag,
utils.SyncModeFlag,
},
Category: "BLOCKCHAIN COMMANDS",
Description: `
Expand Down
1 change: 0 additions & 1 deletion cmd/XDC/dbcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ var (
Flags: []cli.Flag{
utils.DataDirFlag,
utils.XDCXDataDirFlag,
utils.LightModeFlag,
},
Description: `
Remove blockchain and state databases`,
Expand Down
4 changes: 1 addition & 3 deletions cmd/XDC/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ var (
utils.TxPoolAccountQueueFlag,
utils.TxPoolGlobalQueueFlag,
utils.TxPoolLifetimeFlag,
utils.FastSyncFlag,
utils.LightModeFlag,
utils.SyncModeFlag,
utils.GCModeFlag,
//utils.LightServFlag,
Expand Down Expand Up @@ -331,7 +329,7 @@ func startNode(ctx *cli.Context, stack *node.Node, cfg XDCConfig) {
// Start auxiliary services if enabled

// Mining only makes sense if a full Ethereum node is running
if ctx.Bool(utils.LightModeFlag.Name) || ctx.String(utils.SyncModeFlag.Name) == "light" {
if ctx.String(utils.SyncModeFlag.Name) == "light" {
utils.Fatalf("Light clients do not support staking")
}

Expand Down
13 changes: 3 additions & 10 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
setBootstrapNodes(ctx, cfg)
// setBootstrapNodesV5(ctx, cfg)

lightClient := ctx.Bool(LightModeFlag.Name) || ctx.String(SyncModeFlag.Name) == "light"
lightClient := ctx.String(SyncModeFlag.Name) == "light"
lightServer := ctx.Int(LightServFlag.Name) != 0
lightPeers := ctx.Int(LightPeersFlag.Name)

Expand Down Expand Up @@ -1395,8 +1395,6 @@ func SetXDCXConfig(ctx *cli.Context, cfg *XDCx.Config, XDCDataDir string) {
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
// Avoid conflicting network flags
CheckExclusive(ctx, MainnetFlag, TestnetFlag, DevnetFlag, DeveloperFlag)
CheckExclusive(ctx, FastSyncFlag, LightModeFlag, SyncModeFlag)
CheckExclusive(ctx, LightServFlag, LightModeFlag)
CheckExclusive(ctx, LightServFlag, SyncModeFlag, "light")

ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
Expand Down Expand Up @@ -1425,15 +1423,10 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
log.Debug("Sanitizing Go's GC trigger", "percent", int(gogc))
godebug.SetGCPercent(int(gogc))

switch {
case ctx.IsSet(SyncModeFlag.Name):
if ctx.IsSet(SyncModeFlag.Name) {
if err = cfg.SyncMode.UnmarshalText([]byte(ctx.String(SyncModeFlag.Name))); err != nil {
Fatalf("invalid --syncmode flag: %v", err)
}
case ctx.Bool(FastSyncFlag.Name):
cfg.SyncMode = downloader.FastSync
case ctx.Bool(LightModeFlag.Name):
cfg.SyncMode = downloader.LightSync
}
if ctx.IsSet(LightServFlag.Name) {
cfg.LightServ = ctx.Int(LightServFlag.Name)
Expand Down Expand Up @@ -1618,7 +1611,7 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node, readonly bool) ethdb.
handles = MakeDatabaseHandles(ctx.Int(FDLimitFlag.Name))
)
name := "chaindata"
if ctx.Bool(LightModeFlag.Name) {
if ctx.String(SyncModeFlag.Name) == "light" {
name = "lightchaindata"
}
chainDb, err := stack.OpenDatabase(name, cache, handles, "", readonly)
Expand Down
12 changes: 0 additions & 12 deletions cmd/utils/flags_legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ var ShowDeprecated = &cli.Command{
}

var DeprecatedFlags = []cli.Flag{
FastSyncFlag,
LightModeFlag,
NoUSBFlag,
LogBacktraceAtFlag,
LogDebugFlag,
Expand All @@ -42,16 +40,6 @@ var DeprecatedFlags = []cli.Flag{
}

var (
FastSyncFlag = &cli.BoolFlag{
Name: "fast",
Usage: "Enable fast syncing through state downloads",
Category: flags.DeprecatedCategory,
}
LightModeFlag = &cli.BoolFlag{
Name: "light",
Usage: "Enable light client mode",
Category: flags.DeprecatedCategory,
}
// Deprecated May 2020, shown in aliased flags section
NoUSBFlag = &cli.BoolFlag{
Name: "nousb",
Expand Down

0 comments on commit ab697ec

Please sign in to comment.