From 422f8fdebac2f662b5b40ccaf3d012742d0820e8 Mon Sep 17 00:00:00 2001 From: renaynay <41963722+renaynay@users.noreply.github.com> Date: Mon, 20 Apr 2020 17:21:30 +0200 Subject: [PATCH] added more warn logs for all deprecated flags for consistency --- cmd/geth/main.go | 17 +++++++++++++---- cmd/geth/usage.go | 2 +- cmd/utils/flags.go | 7 +++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index f267a6cb16..bf739ea9e4 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -20,6 +20,7 @@ package main import ( "fmt" "math" + "math/big" "os" "runtime" godebug "runtime/debug" @@ -457,13 +458,21 @@ func startNode(ctx *cli.Context, stack *node.Node) { utils.Fatalf("Ethereum service not running: %v", err) } // Set the gas price to the limits from the CLI and start mining - gasprice := utils.GlobalBig(ctx, utils.MinerLegacyGasPriceFlag.Name) - if ctx.IsSet(utils.MinerGasPriceFlag.Name) { - gasprice = utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name) + var gasprice *big.Int + if ctx.IsSet(utils.MinerLegacyGasPriceFlag.Name) { + gasprice = utils.GlobalBig(ctx, utils.MinerLegacyGasPriceFlag.Name) + log.Warn("The flag --gasprice is deprecated and will be removed in the future, please use --miner.gasprice") } + gasprice = utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name) ethereum.TxPool().SetGasPrice(gasprice) - threads := ctx.GlobalInt(utils.MinerLegacyThreadsFlag.Name) + var threads int + if ctx.GlobalIsSet(utils.MinerLegacyThreadsFlag.Name) { + threads = ctx.GlobalInt(utils.MinerLegacyThreadsFlag.Name) + log.Warn("The flag --minerthreads is deprecated and will be removed in the future, please use --miner.threads") + } + threads = ctx.GlobalInt(utils.MinerThreadsFlag.Name) + if ctx.GlobalIsSet(utils.MinerThreadsFlag.Name) { threads = ctx.GlobalInt(utils.MinerThreadsFlag.Name) } diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index 8a9b91053b..5071acc754 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -243,7 +243,7 @@ var AppHelpFlagGroups = []flagGroup{ Flags: whisperFlags, }, { - Name: "ALIASED OPTIONS (deprecated)", + Name: "ALIASED (deprecated)", Flags: append([]cli.Flag{ utils.LegacyTestnetFlag, utils.LightLegacyServFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 729b4015b9..85be4133c9 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1102,6 +1102,7 @@ func setIPC(ctx *cli.Context, cfg *node.Config) { func setLes(ctx *cli.Context, cfg *eth.Config) { if ctx.GlobalIsSet(LightLegacyServFlag.Name) { cfg.LightServ = ctx.GlobalInt(LightLegacyServFlag.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) @@ -1114,6 +1115,7 @@ func setLes(ctx *cli.Context, cfg *eth.Config) { } if ctx.GlobalIsSet(LightLegacyPeersFlag.Name) { cfg.LightPeers = ctx.GlobalInt(LightLegacyPeersFlag.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) @@ -1179,6 +1181,8 @@ func setEtherbase(ctx *cli.Context, ks *keystore.KeyStore, cfg *eth.Config) { var etherbase string if ctx.GlobalIsSet(MinerLegacyEtherbaseFlag.Name) { etherbase = ctx.GlobalString(MinerLegacyEtherbaseFlag.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) @@ -1456,12 +1460,14 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) { } if ctx.GlobalIsSet(MinerLegacyExtraDataFlag.Name) { cfg.ExtraData = []byte(ctx.GlobalString(MinerLegacyExtraDataFlag.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(MinerLegacyGasTargetFlag.Name) { cfg.GasFloor = ctx.GlobalUint64(MinerLegacyGasTargetFlag.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) @@ -1471,6 +1477,7 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) { } if ctx.GlobalIsSet(MinerLegacyGasPriceFlag.Name) { cfg.GasPrice = GlobalBig(ctx, MinerLegacyGasPriceFlag.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)