From 89a30028367ca6cbb84327bff323c6b297baa62e Mon Sep 17 00:00:00 2001 From: q9f <58883403+q9f@users.noreply.github.com> Date: Wed, 1 Apr 2020 18:14:21 +0200 Subject: [PATCH] cmd/util: mark --testnet flag as deprecated --- cmd/utils/flags.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 5036aaf765..f955e2c770 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -165,9 +165,9 @@ var ( Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby, 5=Görli)", Value: eth.DefaultConfig.NetworkId, } - TestnetFlag = cli.BoolFlag{ + LegacyTestnetFlag = cli.BoolFlag{ Name: "testnet", - Usage: "Görli network: pre-configured proof-of-authority test network", + Usage: "Deprecated ambiguous flag: Please choose one of --goerli, --rinkeby, or --ropsten.", } RopstenFlag = cli.BoolFlag{ Name: "ropsten", @@ -781,13 +781,13 @@ var ( // then a subdirectory of the specified data-dir will be used. func MakeDataDir(ctx *cli.Context) string { if path := ctx.GlobalString(DataDirFlag.Name); path != "" { - if ctx.GlobalBool(RopstenFlag.Name) { + if ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name) { return filepath.Join(path, "testnet") } if ctx.GlobalBool(RinkebyFlag.Name) { return filepath.Join(path, "rinkeby") } - if ctx.GlobalBool(TestnetFlag.Name) || ctx.GlobalBool(GoerliFlag.Name) { + if ctx.GlobalBool(GoerliFlag.Name) { return filepath.Join(path, "goerli") } return path @@ -840,11 +840,11 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) { } else { urls = splitAndTrim(ctx.GlobalString(BootnodesFlag.Name)) } - case ctx.GlobalBool(RopstenFlag.Name): + case ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name): urls = params.RopstenBootnodes case ctx.GlobalBool(RinkebyFlag.Name): urls = params.RinkebyBootnodes - case ctx.GlobalBool(TestnetFlag.Name) || ctx.GlobalBool(GoerliFlag.Name): + case ctx.GlobalBool(GoerliFlag.Name): urls = params.GoerliBootnodes case cfg.BootstrapNodes != nil: return // already set, don't apply defaults. @@ -1244,11 +1244,11 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) { cfg.DataDir = ctx.GlobalString(DataDirFlag.Name) case ctx.GlobalBool(DeveloperFlag.Name): cfg.DataDir = "" // unless explicitly requested, use memory databases - case ctx.GlobalBool(RopstenFlag.Name) && cfg.DataDir == node.DefaultDataDir(): + case (ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name)) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet") case ctx.GlobalBool(RinkebyFlag.Name) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby") - case (ctx.GlobalBool(TestnetFlag.Name) || ctx.GlobalBool(GoerliFlag.Name)) && cfg.DataDir == node.DefaultDataDir(): + case ctx.GlobalBool(GoerliFlag.Name) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "goerli") } } @@ -1445,7 +1445,7 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) { // SetEthConfig applies eth-related command line flags to the config. func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { // Avoid conflicting network flags - CheckExclusive(ctx, DeveloperFlag, TestnetFlag, RopstenFlag, RinkebyFlag, GoerliFlag) + CheckExclusive(ctx, DeveloperFlag, LegacyTestnetFlag, RopstenFlag, RinkebyFlag, GoerliFlag) CheckExclusive(ctx, LightLegacyServFlag, LightServeFlag, SyncModeFlag, "light") CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer @@ -1525,7 +1525,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { // Override any default configs for hard coded networks. switch { - case ctx.GlobalBool(RopstenFlag.Name): + case ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name): if !ctx.GlobalIsSet(NetworkIdFlag.Name) { cfg.NetworkId = 3 } @@ -1537,7 +1537,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { } cfg.Genesis = core.DefaultRinkebyGenesisBlock() setDNSDiscoveryDefaults(cfg, params.KnownDNSNetworks[params.RinkebyGenesisHash]) - case ctx.GlobalBool(TestnetFlag.Name) || ctx.GlobalBool(GoerliFlag.Name): + case ctx.GlobalBool(GoerliFlag.Name): if !ctx.GlobalIsSet(NetworkIdFlag.Name) { cfg.NetworkId = 5 } @@ -1712,11 +1712,11 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node) ethdb.Database { func MakeGenesis(ctx *cli.Context) *core.Genesis { var genesis *core.Genesis switch { - case ctx.GlobalBool(RopstenFlag.Name): + case ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name): genesis = core.DefaultRopstenGenesisBlock() case ctx.GlobalBool(RinkebyFlag.Name): genesis = core.DefaultRinkebyGenesisBlock() - case ctx.GlobalBool(TestnetFlag.Name) || ctx.GlobalBool(GoerliFlag.Name): + case ctx.GlobalBool(GoerliFlag.Name): genesis = core.DefaultGoerliGenesisBlock() case ctx.GlobalBool(DeveloperFlag.Name): Fatalf("Developer chains are ephemeral")