cmd/utils: remove deprecated command line flags (#22263)
This removes support for all deprecated flags except --rpc*.
This commit is contained in:
@ -765,13 +765,9 @@ var (
|
||||
// then a subdirectory of the specified datadir will be used.
|
||||
func MakeDataDir(ctx *cli.Context) string {
|
||||
if path := ctx.GlobalString(DataDirFlag.Name); path != "" {
|
||||
if ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name) {
|
||||
if ctx.GlobalBool(RopstenFlag.Name) {
|
||||
// Maintain compatibility with older Geth configurations storing the
|
||||
// Ropsten database in `testnet` instead of `ropsten`.
|
||||
legacyPath := filepath.Join(path, "testnet")
|
||||
if _, err := os.Stat(legacyPath); !os.IsNotExist(err) {
|
||||
return legacyPath
|
||||
}
|
||||
return filepath.Join(path, "ropsten")
|
||||
}
|
||||
if ctx.GlobalBool(RinkebyFlag.Name) {
|
||||
@ -827,13 +823,9 @@ func setNodeUserIdent(ctx *cli.Context, cfg *node.Config) {
|
||||
func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
|
||||
urls := params.MainnetBootnodes
|
||||
switch {
|
||||
case ctx.GlobalIsSet(BootnodesFlag.Name) || ctx.GlobalIsSet(LegacyBootnodesV4Flag.Name):
|
||||
if ctx.GlobalIsSet(LegacyBootnodesV4Flag.Name) {
|
||||
urls = SplitAndTrim(ctx.GlobalString(LegacyBootnodesV4Flag.Name))
|
||||
} else {
|
||||
urls = SplitAndTrim(ctx.GlobalString(BootnodesFlag.Name))
|
||||
}
|
||||
case ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name):
|
||||
case ctx.GlobalIsSet(BootnodesFlag.Name):
|
||||
urls = SplitAndTrim(ctx.GlobalString(BootnodesFlag.Name))
|
||||
case ctx.GlobalBool(RopstenFlag.Name):
|
||||
urls = params.RopstenBootnodes
|
||||
case ctx.GlobalBool(RinkebyFlag.Name):
|
||||
urls = params.RinkebyBootnodes
|
||||
@ -863,12 +855,8 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
|
||||
func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
|
||||
urls := params.V5Bootnodes
|
||||
switch {
|
||||
case ctx.GlobalIsSet(BootnodesFlag.Name) || ctx.GlobalIsSet(LegacyBootnodesV5Flag.Name):
|
||||
if ctx.GlobalIsSet(LegacyBootnodesV5Flag.Name) {
|
||||
urls = SplitAndTrim(ctx.GlobalString(LegacyBootnodesV5Flag.Name))
|
||||
} else {
|
||||
urls = SplitAndTrim(ctx.GlobalString(BootnodesFlag.Name))
|
||||
}
|
||||
case ctx.GlobalIsSet(BootnodesFlag.Name):
|
||||
urls = SplitAndTrim(ctx.GlobalString(BootnodesFlag.Name))
|
||||
case cfg.BootstrapNodesV5 != nil:
|
||||
return // already set, don't apply defaults.
|
||||
}
|
||||
@ -921,11 +909,11 @@ func SplitAndTrim(input string) (ret []string) {
|
||||
// command line flags, returning empty if the HTTP endpoint is disabled.
|
||||
func setHTTP(ctx *cli.Context, cfg *node.Config) {
|
||||
if ctx.GlobalBool(LegacyRPCEnabledFlag.Name) && cfg.HTTPHost == "" {
|
||||
log.Warn("The flag --rpc is deprecated and will be removed in the future, please use --http")
|
||||
log.Warn("The flag --rpc is deprecated and will be removed June 2021, please use --http")
|
||||
cfg.HTTPHost = "127.0.0.1"
|
||||
if ctx.GlobalIsSet(LegacyRPCListenAddrFlag.Name) {
|
||||
cfg.HTTPHost = ctx.GlobalString(LegacyRPCListenAddrFlag.Name)
|
||||
log.Warn("The flag --rpcaddr is deprecated and will be removed in the future, please use --http.addr")
|
||||
log.Warn("The flag --rpcaddr is deprecated and will be removed June 2021, please use --http.addr")
|
||||
}
|
||||
}
|
||||
if ctx.GlobalBool(HTTPEnabledFlag.Name) && cfg.HTTPHost == "" {
|
||||
@ -937,7 +925,7 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) {
|
||||
|
||||
if ctx.GlobalIsSet(LegacyRPCPortFlag.Name) {
|
||||
cfg.HTTPPort = ctx.GlobalInt(LegacyRPCPortFlag.Name)
|
||||
log.Warn("The flag --rpcport is deprecated and will be removed in the future, please use --http.port")
|
||||
log.Warn("The flag --rpcport is deprecated and will be removed June 2021, please use --http.port")
|
||||
}
|
||||
if ctx.GlobalIsSet(HTTPPortFlag.Name) {
|
||||
cfg.HTTPPort = ctx.GlobalInt(HTTPPortFlag.Name)
|
||||
@ -945,7 +933,7 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) {
|
||||
|
||||
if ctx.GlobalIsSet(LegacyRPCCORSDomainFlag.Name) {
|
||||
cfg.HTTPCors = SplitAndTrim(ctx.GlobalString(LegacyRPCCORSDomainFlag.Name))
|
||||
log.Warn("The flag --rpccorsdomain is deprecated and will be removed in the future, please use --http.corsdomain")
|
||||
log.Warn("The flag --rpccorsdomain is deprecated and will be removed June 2021, please use --http.corsdomain")
|
||||
}
|
||||
if ctx.GlobalIsSet(HTTPCORSDomainFlag.Name) {
|
||||
cfg.HTTPCors = SplitAndTrim(ctx.GlobalString(HTTPCORSDomainFlag.Name))
|
||||
@ -953,7 +941,7 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) {
|
||||
|
||||
if ctx.GlobalIsSet(LegacyRPCApiFlag.Name) {
|
||||
cfg.HTTPModules = SplitAndTrim(ctx.GlobalString(LegacyRPCApiFlag.Name))
|
||||
log.Warn("The flag --rpcapi is deprecated and will be removed in the future, please use --http.api")
|
||||
log.Warn("The flag --rpcapi is deprecated and will be removed June 2021, please use --http.api")
|
||||
}
|
||||
if ctx.GlobalIsSet(HTTPApiFlag.Name) {
|
||||
cfg.HTTPModules = SplitAndTrim(ctx.GlobalString(HTTPApiFlag.Name))
|
||||
@ -961,7 +949,7 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) {
|
||||
|
||||
if ctx.GlobalIsSet(LegacyRPCVirtualHostsFlag.Name) {
|
||||
cfg.HTTPVirtualHosts = SplitAndTrim(ctx.GlobalString(LegacyRPCVirtualHostsFlag.Name))
|
||||
log.Warn("The flag --rpcvhosts is deprecated and will be removed in the future, please use --http.vhosts")
|
||||
log.Warn("The flag --rpcvhosts is deprecated and will be removed June 2021, please use --http.vhosts")
|
||||
}
|
||||
if ctx.GlobalIsSet(HTTPVirtualHostsFlag.Name) {
|
||||
cfg.HTTPVirtualHosts = SplitAndTrim(ctx.GlobalString(HTTPVirtualHostsFlag.Name))
|
||||
@ -991,34 +979,18 @@ func setGraphQL(ctx *cli.Context, cfg *node.Config) {
|
||||
func setWS(ctx *cli.Context, cfg *node.Config) {
|
||||
if ctx.GlobalBool(WSEnabledFlag.Name) && cfg.WSHost == "" {
|
||||
cfg.WSHost = "127.0.0.1"
|
||||
if ctx.GlobalIsSet(LegacyWSListenAddrFlag.Name) {
|
||||
cfg.WSHost = ctx.GlobalString(LegacyWSListenAddrFlag.Name)
|
||||
log.Warn("The flag --wsaddr is deprecated and will be removed in the future, please use --ws.addr")
|
||||
}
|
||||
if ctx.GlobalIsSet(WSListenAddrFlag.Name) {
|
||||
cfg.WSHost = ctx.GlobalString(WSListenAddrFlag.Name)
|
||||
}
|
||||
}
|
||||
if ctx.GlobalIsSet(LegacyWSPortFlag.Name) {
|
||||
cfg.WSPort = ctx.GlobalInt(LegacyWSPortFlag.Name)
|
||||
log.Warn("The flag --wsport is deprecated and will be removed in the future, please use --ws.port")
|
||||
}
|
||||
if ctx.GlobalIsSet(WSPortFlag.Name) {
|
||||
cfg.WSPort = ctx.GlobalInt(WSPortFlag.Name)
|
||||
}
|
||||
|
||||
if ctx.GlobalIsSet(LegacyWSAllowedOriginsFlag.Name) {
|
||||
cfg.WSOrigins = SplitAndTrim(ctx.GlobalString(LegacyWSAllowedOriginsFlag.Name))
|
||||
log.Warn("The flag --wsorigins is deprecated and will be removed in the future, please use --ws.origins")
|
||||
}
|
||||
if ctx.GlobalIsSet(WSAllowedOriginsFlag.Name) {
|
||||
cfg.WSOrigins = SplitAndTrim(ctx.GlobalString(WSAllowedOriginsFlag.Name))
|
||||
}
|
||||
|
||||
if ctx.GlobalIsSet(LegacyWSApiFlag.Name) {
|
||||
cfg.WSModules = SplitAndTrim(ctx.GlobalString(LegacyWSApiFlag.Name))
|
||||
log.Warn("The flag --wsapi is deprecated and will be removed in the future, please use --ws.api")
|
||||
}
|
||||
if ctx.GlobalIsSet(WSApiFlag.Name) {
|
||||
cfg.WSModules = SplitAndTrim(ctx.GlobalString(WSApiFlag.Name))
|
||||
}
|
||||
@ -1042,10 +1014,6 @@ func setIPC(ctx *cli.Context, cfg *node.Config) {
|
||||
|
||||
// setLes configures the les server and ultra light client settings from the command line flags.
|
||||
func setLes(ctx *cli.Context, cfg *ethconfig.Config) {
|
||||
if ctx.GlobalIsSet(LegacyLightServFlag.Name) {
|
||||
cfg.LightServ = ctx.GlobalInt(LegacyLightServFlag.Name)
|
||||
log.Warn("The flag --lightserv is deprecated and will be removed in the future, please use --light.serve")
|
||||
}
|
||||
if ctx.GlobalIsSet(LightServeFlag.Name) {
|
||||
cfg.LightServ = ctx.GlobalInt(LightServeFlag.Name)
|
||||
}
|
||||
@ -1055,10 +1023,6 @@ func setLes(ctx *cli.Context, cfg *ethconfig.Config) {
|
||||
if ctx.GlobalIsSet(LightEgressFlag.Name) {
|
||||
cfg.LightEgress = ctx.GlobalInt(LightEgressFlag.Name)
|
||||
}
|
||||
if ctx.GlobalIsSet(LegacyLightPeersFlag.Name) {
|
||||
cfg.LightPeers = ctx.GlobalInt(LegacyLightPeersFlag.Name)
|
||||
log.Warn("The flag --lightpeers is deprecated and will be removed in the future, please use --light.maxpeers")
|
||||
}
|
||||
if ctx.GlobalIsSet(LightMaxPeersFlag.Name) {
|
||||
cfg.LightPeers = ctx.GlobalInt(LightMaxPeersFlag.Name)
|
||||
}
|
||||
@ -1122,13 +1086,8 @@ func MakeAddress(ks *keystore.KeyStore, account string) (accounts.Account, error
|
||||
// setEtherbase retrieves the etherbase either from the directly specified
|
||||
// command line flags or from the keystore if CLI indexed.
|
||||
func setEtherbase(ctx *cli.Context, ks *keystore.KeyStore, cfg *ethconfig.Config) {
|
||||
// Extract the current etherbase, new flag overriding legacy one
|
||||
// Extract the current etherbase
|
||||
var etherbase string
|
||||
if ctx.GlobalIsSet(LegacyMinerEtherbaseFlag.Name) {
|
||||
etherbase = ctx.GlobalString(LegacyMinerEtherbaseFlag.Name)
|
||||
log.Warn("The flag --etherbase is deprecated and will be removed in the future, please use --miner.etherbase")
|
||||
|
||||
}
|
||||
if ctx.GlobalIsSet(MinerEtherbaseFlag.Name) {
|
||||
etherbase = ctx.GlobalString(MinerEtherbaseFlag.Name)
|
||||
}
|
||||
@ -1172,27 +1131,24 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
|
||||
setBootstrapNodesV5(ctx, cfg)
|
||||
|
||||
lightClient := ctx.GlobalString(SyncModeFlag.Name) == "light"
|
||||
lightServer := (ctx.GlobalInt(LegacyLightServFlag.Name) != 0 || ctx.GlobalInt(LightServeFlag.Name) != 0)
|
||||
lightServer := (ctx.GlobalInt(LightServeFlag.Name) != 0)
|
||||
|
||||
lightPeers := ctx.GlobalInt(LegacyLightPeersFlag.Name)
|
||||
if ctx.GlobalIsSet(LightMaxPeersFlag.Name) {
|
||||
lightPeers = ctx.GlobalInt(LightMaxPeersFlag.Name)
|
||||
}
|
||||
if lightClient && !ctx.GlobalIsSet(LegacyLightPeersFlag.Name) && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) {
|
||||
lightPeers := ctx.GlobalInt(LightMaxPeersFlag.Name)
|
||||
if lightClient && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) {
|
||||
// dynamic default - for clients we use 1/10th of the default for servers
|
||||
lightPeers /= 10
|
||||
}
|
||||
|
||||
if ctx.GlobalIsSet(MaxPeersFlag.Name) {
|
||||
cfg.MaxPeers = ctx.GlobalInt(MaxPeersFlag.Name)
|
||||
if lightServer && !ctx.GlobalIsSet(LegacyLightPeersFlag.Name) && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) {
|
||||
if lightServer && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) {
|
||||
cfg.MaxPeers += lightPeers
|
||||
}
|
||||
} else {
|
||||
if lightServer {
|
||||
cfg.MaxPeers += lightPeers
|
||||
}
|
||||
if lightClient && (ctx.GlobalIsSet(LegacyLightPeersFlag.Name) || ctx.GlobalIsSet(LightMaxPeersFlag.Name)) && cfg.MaxPeers < lightPeers {
|
||||
if lightClient && ctx.GlobalIsSet(LightMaxPeersFlag.Name) && cfg.MaxPeers < lightPeers {
|
||||
cfg.MaxPeers = lightPeers
|
||||
}
|
||||
}
|
||||
@ -1297,7 +1253,7 @@ 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(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name)) && cfg.DataDir == node.DefaultDataDir():
|
||||
case ctx.GlobalBool(RopstenFlag.Name) && cfg.DataDir == node.DefaultDataDir():
|
||||
// Maintain compatibility with older Geth configurations storing the
|
||||
// Ropsten database in `testnet` instead of `ropsten`.
|
||||
legacyPath := filepath.Join(node.DefaultDataDir(), "testnet")
|
||||
@ -1307,6 +1263,8 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) {
|
||||
} else {
|
||||
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "ropsten")
|
||||
}
|
||||
|
||||
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "ropsten")
|
||||
case ctx.GlobalBool(RinkebyFlag.Name) && cfg.DataDir == node.DefaultDataDir():
|
||||
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby")
|
||||
case ctx.GlobalBool(GoerliFlag.Name) && cfg.DataDir == node.DefaultDataDir():
|
||||
@ -1323,17 +1281,9 @@ func setGPO(ctx *cli.Context, cfg *gasprice.Config, light bool) {
|
||||
cfg.Blocks = ethconfig.LightClientGPO.Blocks
|
||||
cfg.Percentile = ethconfig.LightClientGPO.Percentile
|
||||
}
|
||||
if ctx.GlobalIsSet(LegacyGpoBlocksFlag.Name) {
|
||||
cfg.Blocks = ctx.GlobalInt(LegacyGpoBlocksFlag.Name)
|
||||
log.Warn("The flag --gpoblocks is deprecated and will be removed in the future, please use --gpo.blocks")
|
||||
}
|
||||
if ctx.GlobalIsSet(GpoBlocksFlag.Name) {
|
||||
cfg.Blocks = ctx.GlobalInt(GpoBlocksFlag.Name)
|
||||
}
|
||||
if ctx.GlobalIsSet(LegacyGpoPercentileFlag.Name) {
|
||||
cfg.Percentile = ctx.GlobalInt(LegacyGpoPercentileFlag.Name)
|
||||
log.Warn("The flag --gpopercentile is deprecated and will be removed in the future, please use --gpo.percentile")
|
||||
}
|
||||
if ctx.GlobalIsSet(GpoPercentileFlag.Name) {
|
||||
cfg.Percentile = ctx.GlobalInt(GpoPercentileFlag.Name)
|
||||
}
|
||||
@ -1416,27 +1366,15 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) {
|
||||
if ctx.GlobalIsSet(MinerNotifyFlag.Name) {
|
||||
cfg.Notify = strings.Split(ctx.GlobalString(MinerNotifyFlag.Name), ",")
|
||||
}
|
||||
if ctx.GlobalIsSet(LegacyMinerExtraDataFlag.Name) {
|
||||
cfg.ExtraData = []byte(ctx.GlobalString(LegacyMinerExtraDataFlag.Name))
|
||||
log.Warn("The flag --extradata is deprecated and will be removed in the future, please use --miner.extradata")
|
||||
}
|
||||
if ctx.GlobalIsSet(MinerExtraDataFlag.Name) {
|
||||
cfg.ExtraData = []byte(ctx.GlobalString(MinerExtraDataFlag.Name))
|
||||
}
|
||||
if ctx.GlobalIsSet(LegacyMinerGasTargetFlag.Name) {
|
||||
cfg.GasFloor = ctx.GlobalUint64(LegacyMinerGasTargetFlag.Name)
|
||||
log.Warn("The flag --targetgaslimit is deprecated and will be removed in the future, please use --miner.gastarget")
|
||||
}
|
||||
if ctx.GlobalIsSet(MinerGasTargetFlag.Name) {
|
||||
cfg.GasFloor = ctx.GlobalUint64(MinerGasTargetFlag.Name)
|
||||
}
|
||||
if ctx.GlobalIsSet(MinerGasLimitFlag.Name) {
|
||||
cfg.GasCeil = ctx.GlobalUint64(MinerGasLimitFlag.Name)
|
||||
}
|
||||
if ctx.GlobalIsSet(LegacyMinerGasPriceFlag.Name) {
|
||||
cfg.GasPrice = GlobalBig(ctx, LegacyMinerGasPriceFlag.Name)
|
||||
log.Warn("The flag --gasprice is deprecated and will be removed in the future, please use --miner.gasprice")
|
||||
}
|
||||
if ctx.GlobalIsSet(MinerGasPriceFlag.Name) {
|
||||
cfg.GasPrice = GlobalBig(ctx, MinerGasPriceFlag.Name)
|
||||
}
|
||||
@ -1525,11 +1463,11 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node) {
|
||||
// SetEthConfig applies eth-related command line flags to the config.
|
||||
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
||||
// Avoid conflicting network flags
|
||||
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, LegacyTestnetFlag, RopstenFlag, RinkebyFlag, GoerliFlag, YoloV3Flag)
|
||||
CheckExclusive(ctx, LegacyLightServFlag, LightServeFlag, SyncModeFlag, "light")
|
||||
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, RopstenFlag, RinkebyFlag, GoerliFlag, YoloV3Flag)
|
||||
CheckExclusive(ctx, LightServeFlag, SyncModeFlag, "light")
|
||||
CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer
|
||||
CheckExclusive(ctx, GCModeFlag, "archive", TxLookupLimitFlag)
|
||||
if (ctx.GlobalIsSet(LegacyLightServFlag.Name) || ctx.GlobalIsSet(LightServeFlag.Name)) && ctx.GlobalIsSet(TxLookupLimitFlag.Name) {
|
||||
if ctx.GlobalIsSet(LightServeFlag.Name) && ctx.GlobalIsSet(TxLookupLimitFlag.Name) {
|
||||
log.Warn("LES server cannot serve old transaction status and cannot connect below les/4 protocol version if transaction lookup index is limited")
|
||||
}
|
||||
var ks *keystore.KeyStore
|
||||
@ -1644,7 +1582,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
||||
}
|
||||
cfg.Genesis = core.DefaultGenesisBlock()
|
||||
SetDNSDiscoveryDefaults(cfg, params.MainnetGenesisHash)
|
||||
case ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name):
|
||||
case ctx.GlobalBool(RopstenFlag.Name):
|
||||
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
|
||||
cfg.NetworkId = 3
|
||||
}
|
||||
@ -1710,7 +1648,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
||||
}
|
||||
chaindb.Close()
|
||||
}
|
||||
if !ctx.GlobalIsSet(MinerGasPriceFlag.Name) && !ctx.GlobalIsSet(LegacyMinerGasPriceFlag.Name) {
|
||||
if !ctx.GlobalIsSet(MinerGasPriceFlag.Name) {
|
||||
cfg.Miner.GasPrice = big.NewInt(1)
|
||||
}
|
||||
default:
|
||||
@ -1849,7 +1787,7 @@ 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(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name):
|
||||
case ctx.GlobalBool(RopstenFlag.Name):
|
||||
genesis = core.DefaultRopstenGenesisBlock()
|
||||
case ctx.GlobalBool(RinkebyFlag.Name):
|
||||
genesis = core.DefaultRinkebyGenesisBlock()
|
||||
|
Reference in New Issue
Block a user