cmd/utils: remove deprecated command line flags (#22263)
This removes support for all deprecated flags except --rpc*.
This commit is contained in:
parent
f54dc4ab3d
commit
8e547eecd5
@ -314,13 +314,13 @@ ones either). To start a `geth` instance for mining, run it with all your usual
|
|||||||
by:
|
by:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ geth <usual-flags> --mine --miner.threads=1 --etherbase=0x0000000000000000000000000000000000000000
|
$ geth <usual-flags> --mine --miner.threads=1 --miner.etherbase=0x0000000000000000000000000000000000000000
|
||||||
```
|
```
|
||||||
|
|
||||||
Which will start mining blocks and transactions on a single CPU thread, crediting all
|
Which will start mining blocks and transactions on a single CPU thread, crediting all
|
||||||
proceedings to the account specified by `--etherbase`. You can further tune the mining
|
proceedings to the account specified by `--miner.etherbase`. You can further tune the mining
|
||||||
by changing the default gas limit blocks converge to (`--targetgaslimit`) and the price
|
by changing the default gas limit blocks converge to (`--miner.targetgaslimit`) and the price
|
||||||
transactions are accepted at (`--gasprice`).
|
transactions are accepted at (`--miner.gasprice`).
|
||||||
|
|
||||||
## Contribution
|
## Contribution
|
||||||
|
|
||||||
|
@ -107,11 +107,6 @@ var (
|
|||||||
Usage: "HTTP-RPC server listening port",
|
Usage: "HTTP-RPC server listening port",
|
||||||
Value: node.DefaultHTTPPort + 5,
|
Value: node.DefaultHTTPPort + 5,
|
||||||
}
|
}
|
||||||
legacyRPCPortFlag = cli.IntFlag{
|
|
||||||
Name: "rpcport",
|
|
||||||
Usage: "HTTP-RPC server listening port (Deprecated, please use --http.port).",
|
|
||||||
Value: node.DefaultHTTPPort + 5,
|
|
||||||
}
|
|
||||||
signerSecretFlag = cli.StringFlag{
|
signerSecretFlag = cli.StringFlag{
|
||||||
Name: "signersecret",
|
Name: "signersecret",
|
||||||
Usage: "A file containing the (encrypted) master seed to encrypt Clef data, e.g. keystore credentials and ruleset hash",
|
Usage: "A file containing the (encrypted) master seed to encrypt Clef data, e.g. keystore credentials and ruleset hash",
|
||||||
@ -250,12 +245,6 @@ var AppHelpFlagGroups = []flags.FlagGroup{
|
|||||||
acceptFlag,
|
acceptFlag,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: "ALIASED (deprecated)",
|
|
||||||
Flags: []cli.Flag{
|
|
||||||
legacyRPCPortFlag,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -283,7 +272,6 @@ func init() {
|
|||||||
testFlag,
|
testFlag,
|
||||||
advancedMode,
|
advancedMode,
|
||||||
acceptFlag,
|
acceptFlag,
|
||||||
legacyRPCPortFlag,
|
|
||||||
}
|
}
|
||||||
app.Action = signer
|
app.Action = signer
|
||||||
app.Commands = []cli.Command{initCommand,
|
app.Commands = []cli.Command{initCommand,
|
||||||
@ -677,12 +665,6 @@ func signer(c *cli.Context) error {
|
|||||||
|
|
||||||
// set port
|
// set port
|
||||||
port := c.Int(rpcPortFlag.Name)
|
port := c.Int(rpcPortFlag.Name)
|
||||||
if c.GlobalIsSet(legacyRPCPortFlag.Name) {
|
|
||||||
if !c.GlobalIsSet(rpcPortFlag.Name) {
|
|
||||||
port = c.Int(legacyRPCPortFlag.Name)
|
|
||||||
}
|
|
||||||
log.Warn("The flag --rpcport is deprecated and will be removed in the future, please use --http.port")
|
|
||||||
}
|
|
||||||
|
|
||||||
// start http server
|
// start http server
|
||||||
httpEndpoint := fmt.Sprintf("%s:%d", c.GlobalString(utils.HTTPListenAddrFlag.Name), port)
|
httpEndpoint := fmt.Sprintf("%s:%d", c.GlobalString(utils.HTTPListenAddrFlag.Name), port)
|
||||||
|
@ -163,7 +163,6 @@ The export-preimages command export hash preimages to an RLP encoded stream`,
|
|||||||
utils.TxLookupLimitFlag,
|
utils.TxLookupLimitFlag,
|
||||||
utils.GoerliFlag,
|
utils.GoerliFlag,
|
||||||
utils.YoloV3Flag,
|
utils.YoloV3Flag,
|
||||||
utils.LegacyTestnetFlag,
|
|
||||||
},
|
},
|
||||||
Category: "BLOCKCHAIN COMMANDS",
|
Category: "BLOCKCHAIN COMMANDS",
|
||||||
Description: `
|
Description: `
|
||||||
|
@ -121,7 +121,7 @@ func remoteConsole(ctx *cli.Context) error {
|
|||||||
path = ctx.GlobalString(utils.DataDirFlag.Name)
|
path = ctx.GlobalString(utils.DataDirFlag.Name)
|
||||||
}
|
}
|
||||||
if path != "" {
|
if path != "" {
|
||||||
if ctx.GlobalBool(utils.LegacyTestnetFlag.Name) || ctx.GlobalBool(utils.RopstenFlag.Name) {
|
if ctx.GlobalBool(utils.RopstenFlag.Name) {
|
||||||
// Maintain compatibility with older Geth configurations storing the
|
// Maintain compatibility with older Geth configurations storing the
|
||||||
// Ropsten database in `testnet` instead of `ropsten`.
|
// Ropsten database in `testnet` instead of `ropsten`.
|
||||||
legacyPath := filepath.Join(path, "testnet")
|
legacyPath := filepath.Join(path, "testnet")
|
||||||
|
@ -53,7 +53,7 @@ func TestConsoleWelcome(t *testing.T) {
|
|||||||
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
|
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
|
||||||
|
|
||||||
// Start a geth console, make sure it's cleaned up and terminate the console
|
// Start a geth console, make sure it's cleaned up and terminate the console
|
||||||
geth := runMinimalGeth(t, "--etherbase", coinbase, "console")
|
geth := runMinimalGeth(t, "--miner.etherbase", coinbase, "console")
|
||||||
|
|
||||||
// Gather all the infos the welcome message needs to contain
|
// Gather all the infos the welcome message needs to contain
|
||||||
geth.SetTemplateFunc("goos", func() string { return runtime.GOOS })
|
geth.SetTemplateFunc("goos", func() string { return runtime.GOOS })
|
||||||
@ -100,7 +100,7 @@ func TestAttachWelcome(t *testing.T) {
|
|||||||
p := trulyRandInt(1024, 65533) // Yeah, sometimes this will fail, sorry :P
|
p := trulyRandInt(1024, 65533) // Yeah, sometimes this will fail, sorry :P
|
||||||
httpPort = strconv.Itoa(p)
|
httpPort = strconv.Itoa(p)
|
||||||
wsPort = strconv.Itoa(p + 1)
|
wsPort = strconv.Itoa(p + 1)
|
||||||
geth := runMinimalGeth(t, "--etherbase", "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182",
|
geth := runMinimalGeth(t, "--miner.etherbase", "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182",
|
||||||
"--ipcpath", ipc,
|
"--ipcpath", ipc,
|
||||||
"--http", "--http.port", httpPort,
|
"--http", "--http.port", httpPort,
|
||||||
"--ws", "--ws.port", wsPort)
|
"--ws", "--ws.port", wsPort)
|
||||||
|
@ -61,8 +61,6 @@ var (
|
|||||||
utils.UnlockedAccountFlag,
|
utils.UnlockedAccountFlag,
|
||||||
utils.PasswordFileFlag,
|
utils.PasswordFileFlag,
|
||||||
utils.BootnodesFlag,
|
utils.BootnodesFlag,
|
||||||
utils.LegacyBootnodesV4Flag,
|
|
||||||
utils.LegacyBootnodesV5Flag,
|
|
||||||
utils.DataDirFlag,
|
utils.DataDirFlag,
|
||||||
utils.AncientFlag,
|
utils.AncientFlag,
|
||||||
utils.MinFreeDiskSpaceFlag,
|
utils.MinFreeDiskSpaceFlag,
|
||||||
@ -96,11 +94,9 @@ var (
|
|||||||
utils.SnapshotFlag,
|
utils.SnapshotFlag,
|
||||||
utils.TxLookupLimitFlag,
|
utils.TxLookupLimitFlag,
|
||||||
utils.LightServeFlag,
|
utils.LightServeFlag,
|
||||||
utils.LegacyLightServFlag,
|
|
||||||
utils.LightIngressFlag,
|
utils.LightIngressFlag,
|
||||||
utils.LightEgressFlag,
|
utils.LightEgressFlag,
|
||||||
utils.LightMaxPeersFlag,
|
utils.LightMaxPeersFlag,
|
||||||
utils.LegacyLightPeersFlag,
|
|
||||||
utils.LightNoPruneFlag,
|
utils.LightNoPruneFlag,
|
||||||
utils.LightKDFFlag,
|
utils.LightKDFFlag,
|
||||||
utils.UltraLightServersFlag,
|
utils.UltraLightServersFlag,
|
||||||
@ -122,17 +118,12 @@ var (
|
|||||||
utils.MaxPendingPeersFlag,
|
utils.MaxPendingPeersFlag,
|
||||||
utils.MiningEnabledFlag,
|
utils.MiningEnabledFlag,
|
||||||
utils.MinerThreadsFlag,
|
utils.MinerThreadsFlag,
|
||||||
utils.LegacyMinerThreadsFlag,
|
|
||||||
utils.MinerNotifyFlag,
|
utils.MinerNotifyFlag,
|
||||||
utils.MinerGasTargetFlag,
|
utils.MinerGasTargetFlag,
|
||||||
utils.LegacyMinerGasTargetFlag,
|
|
||||||
utils.MinerGasLimitFlag,
|
utils.MinerGasLimitFlag,
|
||||||
utils.MinerGasPriceFlag,
|
utils.MinerGasPriceFlag,
|
||||||
utils.LegacyMinerGasPriceFlag,
|
|
||||||
utils.MinerEtherbaseFlag,
|
utils.MinerEtherbaseFlag,
|
||||||
utils.LegacyMinerEtherbaseFlag,
|
|
||||||
utils.MinerExtraDataFlag,
|
utils.MinerExtraDataFlag,
|
||||||
utils.LegacyMinerExtraDataFlag,
|
|
||||||
utils.MinerRecommitIntervalFlag,
|
utils.MinerRecommitIntervalFlag,
|
||||||
utils.MinerNoVerfiyFlag,
|
utils.MinerNoVerfiyFlag,
|
||||||
utils.NATFlag,
|
utils.NATFlag,
|
||||||
@ -145,7 +136,6 @@ var (
|
|||||||
utils.MainnetFlag,
|
utils.MainnetFlag,
|
||||||
utils.DeveloperFlag,
|
utils.DeveloperFlag,
|
||||||
utils.DeveloperPeriodFlag,
|
utils.DeveloperPeriodFlag,
|
||||||
utils.LegacyTestnetFlag,
|
|
||||||
utils.RopstenFlag,
|
utils.RopstenFlag,
|
||||||
utils.RinkebyFlag,
|
utils.RinkebyFlag,
|
||||||
utils.GoerliFlag,
|
utils.GoerliFlag,
|
||||||
@ -158,9 +148,7 @@ var (
|
|||||||
utils.FakePoWFlag,
|
utils.FakePoWFlag,
|
||||||
utils.NoCompactionFlag,
|
utils.NoCompactionFlag,
|
||||||
utils.GpoBlocksFlag,
|
utils.GpoBlocksFlag,
|
||||||
utils.LegacyGpoBlocksFlag,
|
|
||||||
utils.GpoPercentileFlag,
|
utils.GpoPercentileFlag,
|
||||||
utils.LegacyGpoPercentileFlag,
|
|
||||||
utils.GpoMaxGasPriceFlag,
|
utils.GpoMaxGasPriceFlag,
|
||||||
utils.EWASMInterpreterFlag,
|
utils.EWASMInterpreterFlag,
|
||||||
utils.EVMInterpreterFlag,
|
utils.EVMInterpreterFlag,
|
||||||
@ -178,22 +166,18 @@ var (
|
|||||||
utils.LegacyRPCPortFlag,
|
utils.LegacyRPCPortFlag,
|
||||||
utils.LegacyRPCCORSDomainFlag,
|
utils.LegacyRPCCORSDomainFlag,
|
||||||
utils.LegacyRPCVirtualHostsFlag,
|
utils.LegacyRPCVirtualHostsFlag,
|
||||||
|
utils.LegacyRPCApiFlag,
|
||||||
utils.GraphQLEnabledFlag,
|
utils.GraphQLEnabledFlag,
|
||||||
utils.GraphQLCORSDomainFlag,
|
utils.GraphQLCORSDomainFlag,
|
||||||
utils.GraphQLVirtualHostsFlag,
|
utils.GraphQLVirtualHostsFlag,
|
||||||
utils.HTTPApiFlag,
|
utils.HTTPApiFlag,
|
||||||
utils.HTTPPathPrefixFlag,
|
utils.HTTPPathPrefixFlag,
|
||||||
utils.LegacyRPCApiFlag,
|
|
||||||
utils.WSEnabledFlag,
|
utils.WSEnabledFlag,
|
||||||
utils.WSListenAddrFlag,
|
utils.WSListenAddrFlag,
|
||||||
utils.LegacyWSListenAddrFlag,
|
|
||||||
utils.WSPortFlag,
|
utils.WSPortFlag,
|
||||||
utils.LegacyWSPortFlag,
|
|
||||||
utils.WSApiFlag,
|
utils.WSApiFlag,
|
||||||
utils.LegacyWSApiFlag,
|
|
||||||
utils.WSAllowedOriginsFlag,
|
utils.WSAllowedOriginsFlag,
|
||||||
utils.WSPathPrefixFlag,
|
utils.WSPathPrefixFlag,
|
||||||
utils.LegacyWSAllowedOriginsFlag,
|
|
||||||
utils.IPCDisabledFlag,
|
utils.IPCDisabledFlag,
|
||||||
utils.IPCPathFlag,
|
utils.IPCPathFlag,
|
||||||
utils.InsecureUnlockAllowedFlag,
|
utils.InsecureUnlockAllowedFlag,
|
||||||
@ -267,7 +251,6 @@ func init() {
|
|||||||
app.Flags = append(app.Flags, rpcFlags...)
|
app.Flags = append(app.Flags, rpcFlags...)
|
||||||
app.Flags = append(app.Flags, consoleFlags...)
|
app.Flags = append(app.Flags, consoleFlags...)
|
||||||
app.Flags = append(app.Flags, debug.Flags...)
|
app.Flags = append(app.Flags, debug.Flags...)
|
||||||
app.Flags = append(app.Flags, debug.DeprecatedFlags...)
|
|
||||||
app.Flags = append(app.Flags, whisperFlags...)
|
app.Flags = append(app.Flags, whisperFlags...)
|
||||||
app.Flags = append(app.Flags, metricsFlags...)
|
app.Flags = append(app.Flags, metricsFlags...)
|
||||||
|
|
||||||
@ -293,11 +276,6 @@ func main() {
|
|||||||
func prepare(ctx *cli.Context) {
|
func prepare(ctx *cli.Context) {
|
||||||
// If we're running a known preset, log it for convenience.
|
// If we're running a known preset, log it for convenience.
|
||||||
switch {
|
switch {
|
||||||
case ctx.GlobalIsSet(utils.LegacyTestnetFlag.Name):
|
|
||||||
log.Info("Starting Geth on Ropsten testnet...")
|
|
||||||
log.Warn("The --testnet flag is ambiguous! Please specify one of --goerli, --rinkeby, or --ropsten.")
|
|
||||||
log.Warn("The generic --testnet flag is deprecated and will be removed in the future!")
|
|
||||||
|
|
||||||
case ctx.GlobalIsSet(utils.RopstenFlag.Name):
|
case ctx.GlobalIsSet(utils.RopstenFlag.Name):
|
||||||
log.Info("Starting Geth on Ropsten testnet...")
|
log.Info("Starting Geth on Ropsten testnet...")
|
||||||
|
|
||||||
@ -316,7 +294,7 @@ func prepare(ctx *cli.Context) {
|
|||||||
// If we're a full node on mainnet without --cache specified, bump default cache allowance
|
// If we're a full node on mainnet without --cache specified, bump default cache allowance
|
||||||
if ctx.GlobalString(utils.SyncModeFlag.Name) != "light" && !ctx.GlobalIsSet(utils.CacheFlag.Name) && !ctx.GlobalIsSet(utils.NetworkIdFlag.Name) {
|
if ctx.GlobalString(utils.SyncModeFlag.Name) != "light" && !ctx.GlobalIsSet(utils.CacheFlag.Name) && !ctx.GlobalIsSet(utils.NetworkIdFlag.Name) {
|
||||||
// Make sure we're not on any supported preconfigured testnet either
|
// Make sure we're not on any supported preconfigured testnet either
|
||||||
if !ctx.GlobalIsSet(utils.LegacyTestnetFlag.Name) && !ctx.GlobalIsSet(utils.RopstenFlag.Name) && !ctx.GlobalIsSet(utils.RinkebyFlag.Name) && !ctx.GlobalIsSet(utils.GoerliFlag.Name) && !ctx.GlobalIsSet(utils.DeveloperFlag.Name) {
|
if !ctx.GlobalIsSet(utils.RopstenFlag.Name) && !ctx.GlobalIsSet(utils.RinkebyFlag.Name) && !ctx.GlobalIsSet(utils.GoerliFlag.Name) && !ctx.GlobalIsSet(utils.DeveloperFlag.Name) {
|
||||||
// Nope, we're really on mainnet. Bump that cache up!
|
// Nope, we're really on mainnet. Bump that cache up!
|
||||||
log.Info("Bumping default cache on mainnet", "provided", ctx.GlobalInt(utils.CacheFlag.Name), "updated", 4096)
|
log.Info("Bumping default cache on mainnet", "provided", ctx.GlobalInt(utils.CacheFlag.Name), "updated", 4096)
|
||||||
ctx.GlobalSet(utils.CacheFlag.Name, strconv.Itoa(4096))
|
ctx.GlobalSet(utils.CacheFlag.Name, strconv.Itoa(4096))
|
||||||
@ -461,19 +439,11 @@ func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
utils.Fatalf("Ethereum service not running: %v", err)
|
utils.Fatalf("Ethereum service not running: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the gas price to the limits from the CLI and start mining
|
// Set the gas price to the limits from the CLI and start mining
|
||||||
gasprice := utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name)
|
gasprice := utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name)
|
||||||
if ctx.GlobalIsSet(utils.LegacyMinerGasPriceFlag.Name) && !ctx.GlobalIsSet(utils.MinerGasPriceFlag.Name) {
|
|
||||||
gasprice = utils.GlobalBig(ctx, utils.LegacyMinerGasPriceFlag.Name)
|
|
||||||
}
|
|
||||||
ethBackend.TxPool().SetGasPrice(gasprice)
|
ethBackend.TxPool().SetGasPrice(gasprice)
|
||||||
// start mining
|
// start mining
|
||||||
threads := ctx.GlobalInt(utils.MinerThreadsFlag.Name)
|
threads := ctx.GlobalInt(utils.MinerThreadsFlag.Name)
|
||||||
if ctx.GlobalIsSet(utils.LegacyMinerThreadsFlag.Name) && !ctx.GlobalIsSet(utils.MinerThreadsFlag.Name) {
|
|
||||||
threads = ctx.GlobalInt(utils.LegacyMinerThreadsFlag.Name)
|
|
||||||
log.Warn("The flag --minerthreads is deprecated and will be removed in the future, please use --miner.threads")
|
|
||||||
}
|
|
||||||
if err := ethBackend.StartMining(threads); err != nil {
|
if err := ethBackend.StartMining(threads); err != nil {
|
||||||
utils.Fatalf("Failed to start mining: %v", err)
|
utils.Fatalf("Failed to start mining: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ func runGeth(t *testing.T, args ...string) *testgeth {
|
|||||||
if i < len(args)-1 {
|
if i < len(args)-1 {
|
||||||
tt.Datadir = args[i+1]
|
tt.Datadir = args[i+1]
|
||||||
}
|
}
|
||||||
case "--etherbase":
|
case "--miner.etherbase":
|
||||||
if i < len(args)-1 {
|
if i < len(args)-1 {
|
||||||
tt.Etherbase = args[i+1]
|
tt.Etherbase = args[i+1]
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,6 @@ var (
|
|||||||
utils.RopstenFlag,
|
utils.RopstenFlag,
|
||||||
utils.RinkebyFlag,
|
utils.RinkebyFlag,
|
||||||
utils.GoerliFlag,
|
utils.GoerliFlag,
|
||||||
utils.LegacyTestnetFlag,
|
|
||||||
utils.CacheTrieJournalFlag,
|
utils.CacheTrieJournalFlag,
|
||||||
utils.BloomFilterSizeFlag,
|
utils.BloomFilterSizeFlag,
|
||||||
},
|
},
|
||||||
@ -90,7 +89,6 @@ the trie clean cache with default directory will be deleted.
|
|||||||
utils.RopstenFlag,
|
utils.RopstenFlag,
|
||||||
utils.RinkebyFlag,
|
utils.RinkebyFlag,
|
||||||
utils.GoerliFlag,
|
utils.GoerliFlag,
|
||||||
utils.LegacyTestnetFlag,
|
|
||||||
},
|
},
|
||||||
Description: `
|
Description: `
|
||||||
geth snapshot verify-state <state-root>
|
geth snapshot verify-state <state-root>
|
||||||
@ -110,7 +108,6 @@ In other words, this command does the snapshot to trie conversion.
|
|||||||
utils.RopstenFlag,
|
utils.RopstenFlag,
|
||||||
utils.RinkebyFlag,
|
utils.RinkebyFlag,
|
||||||
utils.GoerliFlag,
|
utils.GoerliFlag,
|
||||||
utils.LegacyTestnetFlag,
|
|
||||||
},
|
},
|
||||||
Description: `
|
Description: `
|
||||||
geth snapshot traverse-state <state-root>
|
geth snapshot traverse-state <state-root>
|
||||||
@ -132,7 +129,6 @@ It's also usable without snapshot enabled.
|
|||||||
utils.RopstenFlag,
|
utils.RopstenFlag,
|
||||||
utils.RinkebyFlag,
|
utils.RinkebyFlag,
|
||||||
utils.GoerliFlag,
|
utils.GoerliFlag,
|
||||||
utils.LegacyTestnetFlag,
|
|
||||||
},
|
},
|
||||||
Description: `
|
Description: `
|
||||||
geth snapshot traverse-rawstate <state-root>
|
geth snapshot traverse-rawstate <state-root>
|
||||||
|
@ -161,8 +161,6 @@ var AppHelpFlagGroups = []flags.FlagGroup{
|
|||||||
Name: "NETWORKING",
|
Name: "NETWORKING",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
utils.BootnodesFlag,
|
utils.BootnodesFlag,
|
||||||
utils.LegacyBootnodesV4Flag,
|
|
||||||
utils.LegacyBootnodesV5Flag,
|
|
||||||
utils.DNSDiscoveryFlag,
|
utils.DNSDiscoveryFlag,
|
||||||
utils.ListenPortFlag,
|
utils.ListenPortFlag,
|
||||||
utils.MaxPeersFlag,
|
utils.MaxPeersFlag,
|
||||||
@ -223,7 +221,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "ALIASED (deprecated)",
|
Name: "ALIASED (deprecated)",
|
||||||
Flags: append([]cli.Flag{
|
Flags: []cli.Flag{
|
||||||
utils.NoUSBFlag,
|
utils.NoUSBFlag,
|
||||||
utils.LegacyRPCEnabledFlag,
|
utils.LegacyRPCEnabledFlag,
|
||||||
utils.LegacyRPCListenAddrFlag,
|
utils.LegacyRPCListenAddrFlag,
|
||||||
@ -231,15 +229,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
|
|||||||
utils.LegacyRPCCORSDomainFlag,
|
utils.LegacyRPCCORSDomainFlag,
|
||||||
utils.LegacyRPCVirtualHostsFlag,
|
utils.LegacyRPCVirtualHostsFlag,
|
||||||
utils.LegacyRPCApiFlag,
|
utils.LegacyRPCApiFlag,
|
||||||
utils.LegacyWSListenAddrFlag,
|
},
|
||||||
utils.LegacyWSPortFlag,
|
|
||||||
utils.LegacyWSAllowedOriginsFlag,
|
|
||||||
utils.LegacyWSApiFlag,
|
|
||||||
utils.LegacyGpoBlocksFlag,
|
|
||||||
utils.LegacyGpoPercentileFlag,
|
|
||||||
utils.LegacyGraphQLListenAddrFlag,
|
|
||||||
utils.LegacyGraphQLPortFlag,
|
|
||||||
}, debug.DeprecatedFlags...),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "MISC",
|
Name: "MISC",
|
||||||
|
@ -94,7 +94,7 @@ func deployNode(client *sshClient, network string, bootnodes []string, config *n
|
|||||||
|
|
||||||
lightFlag := ""
|
lightFlag := ""
|
||||||
if config.peersLight > 0 {
|
if config.peersLight > 0 {
|
||||||
lightFlag = fmt.Sprintf("--lightpeers=%d --lightserv=50", config.peersLight)
|
lightFlag = fmt.Sprintf("--light.maxpeers=%d --light.serve=50", config.peersLight)
|
||||||
}
|
}
|
||||||
dockerfile := new(bytes.Buffer)
|
dockerfile := new(bytes.Buffer)
|
||||||
template.Must(template.New("").Parse(nodeDockerfile)).Execute(dockerfile, map[string]interface{}{
|
template.Must(template.New("").Parse(nodeDockerfile)).Execute(dockerfile, map[string]interface{}{
|
||||||
|
@ -765,13 +765,9 @@ var (
|
|||||||
// then a subdirectory of the specified datadir will be used.
|
// then a subdirectory of the specified datadir will be used.
|
||||||
func MakeDataDir(ctx *cli.Context) string {
|
func MakeDataDir(ctx *cli.Context) string {
|
||||||
if path := ctx.GlobalString(DataDirFlag.Name); path != "" {
|
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
|
// Maintain compatibility with older Geth configurations storing the
|
||||||
// Ropsten database in `testnet` instead of `ropsten`.
|
// 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")
|
return filepath.Join(path, "ropsten")
|
||||||
}
|
}
|
||||||
if ctx.GlobalBool(RinkebyFlag.Name) {
|
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) {
|
func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
|
||||||
urls := params.MainnetBootnodes
|
urls := params.MainnetBootnodes
|
||||||
switch {
|
switch {
|
||||||
case ctx.GlobalIsSet(BootnodesFlag.Name) || ctx.GlobalIsSet(LegacyBootnodesV4Flag.Name):
|
case ctx.GlobalIsSet(BootnodesFlag.Name):
|
||||||
if ctx.GlobalIsSet(LegacyBootnodesV4Flag.Name) {
|
|
||||||
urls = SplitAndTrim(ctx.GlobalString(LegacyBootnodesV4Flag.Name))
|
|
||||||
} else {
|
|
||||||
urls = SplitAndTrim(ctx.GlobalString(BootnodesFlag.Name))
|
urls = SplitAndTrim(ctx.GlobalString(BootnodesFlag.Name))
|
||||||
}
|
case ctx.GlobalBool(RopstenFlag.Name):
|
||||||
case ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name):
|
|
||||||
urls = params.RopstenBootnodes
|
urls = params.RopstenBootnodes
|
||||||
case ctx.GlobalBool(RinkebyFlag.Name):
|
case ctx.GlobalBool(RinkebyFlag.Name):
|
||||||
urls = params.RinkebyBootnodes
|
urls = params.RinkebyBootnodes
|
||||||
@ -863,12 +855,8 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
|
|||||||
func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
|
func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
|
||||||
urls := params.V5Bootnodes
|
urls := params.V5Bootnodes
|
||||||
switch {
|
switch {
|
||||||
case ctx.GlobalIsSet(BootnodesFlag.Name) || ctx.GlobalIsSet(LegacyBootnodesV5Flag.Name):
|
case ctx.GlobalIsSet(BootnodesFlag.Name):
|
||||||
if ctx.GlobalIsSet(LegacyBootnodesV5Flag.Name) {
|
|
||||||
urls = SplitAndTrim(ctx.GlobalString(LegacyBootnodesV5Flag.Name))
|
|
||||||
} else {
|
|
||||||
urls = SplitAndTrim(ctx.GlobalString(BootnodesFlag.Name))
|
urls = SplitAndTrim(ctx.GlobalString(BootnodesFlag.Name))
|
||||||
}
|
|
||||||
case cfg.BootstrapNodesV5 != nil:
|
case cfg.BootstrapNodesV5 != nil:
|
||||||
return // already set, don't apply defaults.
|
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.
|
// command line flags, returning empty if the HTTP endpoint is disabled.
|
||||||
func setHTTP(ctx *cli.Context, cfg *node.Config) {
|
func setHTTP(ctx *cli.Context, cfg *node.Config) {
|
||||||
if ctx.GlobalBool(LegacyRPCEnabledFlag.Name) && cfg.HTTPHost == "" {
|
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"
|
cfg.HTTPHost = "127.0.0.1"
|
||||||
if ctx.GlobalIsSet(LegacyRPCListenAddrFlag.Name) {
|
if ctx.GlobalIsSet(LegacyRPCListenAddrFlag.Name) {
|
||||||
cfg.HTTPHost = ctx.GlobalString(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 == "" {
|
if ctx.GlobalBool(HTTPEnabledFlag.Name) && cfg.HTTPHost == "" {
|
||||||
@ -937,7 +925,7 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) {
|
|||||||
|
|
||||||
if ctx.GlobalIsSet(LegacyRPCPortFlag.Name) {
|
if ctx.GlobalIsSet(LegacyRPCPortFlag.Name) {
|
||||||
cfg.HTTPPort = ctx.GlobalInt(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) {
|
if ctx.GlobalIsSet(HTTPPortFlag.Name) {
|
||||||
cfg.HTTPPort = ctx.GlobalInt(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) {
|
if ctx.GlobalIsSet(LegacyRPCCORSDomainFlag.Name) {
|
||||||
cfg.HTTPCors = SplitAndTrim(ctx.GlobalString(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) {
|
if ctx.GlobalIsSet(HTTPCORSDomainFlag.Name) {
|
||||||
cfg.HTTPCors = SplitAndTrim(ctx.GlobalString(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) {
|
if ctx.GlobalIsSet(LegacyRPCApiFlag.Name) {
|
||||||
cfg.HTTPModules = SplitAndTrim(ctx.GlobalString(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) {
|
if ctx.GlobalIsSet(HTTPApiFlag.Name) {
|
||||||
cfg.HTTPModules = SplitAndTrim(ctx.GlobalString(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) {
|
if ctx.GlobalIsSet(LegacyRPCVirtualHostsFlag.Name) {
|
||||||
cfg.HTTPVirtualHosts = SplitAndTrim(ctx.GlobalString(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) {
|
if ctx.GlobalIsSet(HTTPVirtualHostsFlag.Name) {
|
||||||
cfg.HTTPVirtualHosts = SplitAndTrim(ctx.GlobalString(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) {
|
func setWS(ctx *cli.Context, cfg *node.Config) {
|
||||||
if ctx.GlobalBool(WSEnabledFlag.Name) && cfg.WSHost == "" {
|
if ctx.GlobalBool(WSEnabledFlag.Name) && cfg.WSHost == "" {
|
||||||
cfg.WSHost = "127.0.0.1"
|
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) {
|
if ctx.GlobalIsSet(WSListenAddrFlag.Name) {
|
||||||
cfg.WSHost = ctx.GlobalString(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) {
|
if ctx.GlobalIsSet(WSPortFlag.Name) {
|
||||||
cfg.WSPort = ctx.GlobalInt(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) {
|
if ctx.GlobalIsSet(WSAllowedOriginsFlag.Name) {
|
||||||
cfg.WSOrigins = SplitAndTrim(ctx.GlobalString(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) {
|
if ctx.GlobalIsSet(WSApiFlag.Name) {
|
||||||
cfg.WSModules = SplitAndTrim(ctx.GlobalString(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.
|
// setLes configures the les server and ultra light client settings from the command line flags.
|
||||||
func setLes(ctx *cli.Context, cfg *ethconfig.Config) {
|
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) {
|
if ctx.GlobalIsSet(LightServeFlag.Name) {
|
||||||
cfg.LightServ = ctx.GlobalInt(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) {
|
if ctx.GlobalIsSet(LightEgressFlag.Name) {
|
||||||
cfg.LightEgress = ctx.GlobalInt(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) {
|
if ctx.GlobalIsSet(LightMaxPeersFlag.Name) {
|
||||||
cfg.LightPeers = ctx.GlobalInt(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
|
// setEtherbase retrieves the etherbase either from the directly specified
|
||||||
// command line flags or from the keystore if CLI indexed.
|
// command line flags or from the keystore if CLI indexed.
|
||||||
func setEtherbase(ctx *cli.Context, ks *keystore.KeyStore, cfg *ethconfig.Config) {
|
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
|
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) {
|
if ctx.GlobalIsSet(MinerEtherbaseFlag.Name) {
|
||||||
etherbase = ctx.GlobalString(MinerEtherbaseFlag.Name)
|
etherbase = ctx.GlobalString(MinerEtherbaseFlag.Name)
|
||||||
}
|
}
|
||||||
@ -1172,27 +1131,24 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
|
|||||||
setBootstrapNodesV5(ctx, cfg)
|
setBootstrapNodesV5(ctx, cfg)
|
||||||
|
|
||||||
lightClient := ctx.GlobalString(SyncModeFlag.Name) == "light"
|
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)
|
lightPeers := ctx.GlobalInt(LightMaxPeersFlag.Name)
|
||||||
if ctx.GlobalIsSet(LightMaxPeersFlag.Name) {
|
if lightClient && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) {
|
||||||
lightPeers = ctx.GlobalInt(LightMaxPeersFlag.Name)
|
|
||||||
}
|
|
||||||
if lightClient && !ctx.GlobalIsSet(LegacyLightPeersFlag.Name) && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) {
|
|
||||||
// dynamic default - for clients we use 1/10th of the default for servers
|
// dynamic default - for clients we use 1/10th of the default for servers
|
||||||
lightPeers /= 10
|
lightPeers /= 10
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.GlobalIsSet(MaxPeersFlag.Name) {
|
if ctx.GlobalIsSet(MaxPeersFlag.Name) {
|
||||||
cfg.MaxPeers = ctx.GlobalInt(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
|
cfg.MaxPeers += lightPeers
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if lightServer {
|
if lightServer {
|
||||||
cfg.MaxPeers += lightPeers
|
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
|
cfg.MaxPeers = lightPeers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1297,7 +1253,7 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) {
|
|||||||
cfg.DataDir = ctx.GlobalString(DataDirFlag.Name)
|
cfg.DataDir = ctx.GlobalString(DataDirFlag.Name)
|
||||||
case ctx.GlobalBool(DeveloperFlag.Name):
|
case ctx.GlobalBool(DeveloperFlag.Name):
|
||||||
cfg.DataDir = "" // unless explicitly requested, use memory databases
|
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
|
// Maintain compatibility with older Geth configurations storing the
|
||||||
// Ropsten database in `testnet` instead of `ropsten`.
|
// Ropsten database in `testnet` instead of `ropsten`.
|
||||||
legacyPath := filepath.Join(node.DefaultDataDir(), "testnet")
|
legacyPath := filepath.Join(node.DefaultDataDir(), "testnet")
|
||||||
@ -1307,6 +1263,8 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) {
|
|||||||
} else {
|
} else {
|
||||||
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "ropsten")
|
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "ropsten")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "ropsten")
|
||||||
case ctx.GlobalBool(RinkebyFlag.Name) && cfg.DataDir == node.DefaultDataDir():
|
case ctx.GlobalBool(RinkebyFlag.Name) && cfg.DataDir == node.DefaultDataDir():
|
||||||
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby")
|
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby")
|
||||||
case ctx.GlobalBool(GoerliFlag.Name) && cfg.DataDir == node.DefaultDataDir():
|
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.Blocks = ethconfig.LightClientGPO.Blocks
|
||||||
cfg.Percentile = ethconfig.LightClientGPO.Percentile
|
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) {
|
if ctx.GlobalIsSet(GpoBlocksFlag.Name) {
|
||||||
cfg.Blocks = ctx.GlobalInt(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) {
|
if ctx.GlobalIsSet(GpoPercentileFlag.Name) {
|
||||||
cfg.Percentile = ctx.GlobalInt(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) {
|
if ctx.GlobalIsSet(MinerNotifyFlag.Name) {
|
||||||
cfg.Notify = strings.Split(ctx.GlobalString(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) {
|
if ctx.GlobalIsSet(MinerExtraDataFlag.Name) {
|
||||||
cfg.ExtraData = []byte(ctx.GlobalString(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) {
|
if ctx.GlobalIsSet(MinerGasTargetFlag.Name) {
|
||||||
cfg.GasFloor = ctx.GlobalUint64(MinerGasTargetFlag.Name)
|
cfg.GasFloor = ctx.GlobalUint64(MinerGasTargetFlag.Name)
|
||||||
}
|
}
|
||||||
if ctx.GlobalIsSet(MinerGasLimitFlag.Name) {
|
if ctx.GlobalIsSet(MinerGasLimitFlag.Name) {
|
||||||
cfg.GasCeil = ctx.GlobalUint64(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) {
|
if ctx.GlobalIsSet(MinerGasPriceFlag.Name) {
|
||||||
cfg.GasPrice = GlobalBig(ctx, 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.
|
// SetEthConfig applies eth-related command line flags to the config.
|
||||||
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
||||||
// Avoid conflicting network flags
|
// Avoid conflicting network flags
|
||||||
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, LegacyTestnetFlag, RopstenFlag, RinkebyFlag, GoerliFlag, YoloV3Flag)
|
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, RopstenFlag, RinkebyFlag, GoerliFlag, YoloV3Flag)
|
||||||
CheckExclusive(ctx, LegacyLightServFlag, LightServeFlag, SyncModeFlag, "light")
|
CheckExclusive(ctx, LightServeFlag, SyncModeFlag, "light")
|
||||||
CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer
|
CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer
|
||||||
CheckExclusive(ctx, GCModeFlag, "archive", TxLookupLimitFlag)
|
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")
|
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
|
var ks *keystore.KeyStore
|
||||||
@ -1644,7 +1582,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
|||||||
}
|
}
|
||||||
cfg.Genesis = core.DefaultGenesisBlock()
|
cfg.Genesis = core.DefaultGenesisBlock()
|
||||||
SetDNSDiscoveryDefaults(cfg, params.MainnetGenesisHash)
|
SetDNSDiscoveryDefaults(cfg, params.MainnetGenesisHash)
|
||||||
case ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name):
|
case ctx.GlobalBool(RopstenFlag.Name):
|
||||||
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
|
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
|
||||||
cfg.NetworkId = 3
|
cfg.NetworkId = 3
|
||||||
}
|
}
|
||||||
@ -1710,7 +1648,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
|||||||
}
|
}
|
||||||
chaindb.Close()
|
chaindb.Close()
|
||||||
}
|
}
|
||||||
if !ctx.GlobalIsSet(MinerGasPriceFlag.Name) && !ctx.GlobalIsSet(LegacyMinerGasPriceFlag.Name) {
|
if !ctx.GlobalIsSet(MinerGasPriceFlag.Name) {
|
||||||
cfg.Miner.GasPrice = big.NewInt(1)
|
cfg.Miner.GasPrice = big.NewInt(1)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -1849,7 +1787,7 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node) ethdb.Database {
|
|||||||
func MakeGenesis(ctx *cli.Context) *core.Genesis {
|
func MakeGenesis(ctx *cli.Context) *core.Genesis {
|
||||||
var genesis *core.Genesis
|
var genesis *core.Genesis
|
||||||
switch {
|
switch {
|
||||||
case ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name):
|
case ctx.GlobalBool(RopstenFlag.Name):
|
||||||
genesis = core.DefaultRopstenGenesisBlock()
|
genesis = core.DefaultRopstenGenesisBlock()
|
||||||
case ctx.GlobalBool(RinkebyFlag.Name):
|
case ctx.GlobalBool(RinkebyFlag.Name):
|
||||||
genesis = core.DefaultRinkebyGenesisBlock()
|
genesis = core.DefaultRinkebyGenesisBlock()
|
||||||
|
@ -20,7 +20,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/eth/ethconfig"
|
|
||||||
"github.com/ethereum/go-ethereum/node"
|
"github.com/ethereum/go-ethereum/node"
|
||||||
"gopkg.in/urfave/cli.v1"
|
"gopkg.in/urfave/cli.v1"
|
||||||
)
|
)
|
||||||
@ -34,143 +33,39 @@ var ShowDeprecated = cli.Command{
|
|||||||
Description: "Show flags that have been deprecated and will soon be removed",
|
Description: "Show flags that have been deprecated and will soon be removed",
|
||||||
}
|
}
|
||||||
|
|
||||||
var DeprecatedFlags = []cli.Flag{
|
var DeprecatedFlags = []cli.Flag{}
|
||||||
LegacyTestnetFlag,
|
|
||||||
LegacyLightServFlag,
|
|
||||||
LegacyLightPeersFlag,
|
|
||||||
LegacyMinerThreadsFlag,
|
|
||||||
LegacyMinerGasTargetFlag,
|
|
||||||
LegacyMinerGasPriceFlag,
|
|
||||||
LegacyMinerEtherbaseFlag,
|
|
||||||
LegacyMinerExtraDataFlag,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// (Deprecated April 2018)
|
|
||||||
LegacyMinerThreadsFlag = cli.IntFlag{
|
|
||||||
Name: "minerthreads",
|
|
||||||
Usage: "Number of CPU threads to use for mining (deprecated, use --miner.threads)",
|
|
||||||
Value: 0,
|
|
||||||
}
|
|
||||||
LegacyMinerGasTargetFlag = cli.Uint64Flag{
|
|
||||||
Name: "targetgaslimit",
|
|
||||||
Usage: "Target gas floor for mined blocks (deprecated, use --miner.gastarget)",
|
|
||||||
Value: ethconfig.Defaults.Miner.GasFloor,
|
|
||||||
}
|
|
||||||
LegacyMinerGasPriceFlag = BigFlag{
|
|
||||||
Name: "gasprice",
|
|
||||||
Usage: "Minimum gas price for mining a transaction (deprecated, use --miner.gasprice)",
|
|
||||||
Value: ethconfig.Defaults.Miner.GasPrice,
|
|
||||||
}
|
|
||||||
LegacyMinerEtherbaseFlag = cli.StringFlag{
|
|
||||||
Name: "etherbase",
|
|
||||||
Usage: "Public address for block mining rewards (default = first account, deprecated, use --miner.etherbase)",
|
|
||||||
Value: "0",
|
|
||||||
}
|
|
||||||
LegacyMinerExtraDataFlag = cli.StringFlag{
|
|
||||||
Name: "extradata",
|
|
||||||
Usage: "Block extra data set by the miner (default = client version, deprecated, use --miner.extradata)",
|
|
||||||
}
|
|
||||||
|
|
||||||
// (Deprecated June 2019)
|
|
||||||
LegacyLightServFlag = cli.IntFlag{
|
|
||||||
Name: "lightserv",
|
|
||||||
Usage: "Maximum percentage of time allowed for serving LES requests (deprecated, use --light.serve)",
|
|
||||||
Value: ethconfig.Defaults.LightServ,
|
|
||||||
}
|
|
||||||
LegacyLightPeersFlag = cli.IntFlag{
|
|
||||||
Name: "lightpeers",
|
|
||||||
Usage: "Maximum number of light clients to serve, or light servers to attach to (deprecated, use --light.maxpeers)",
|
|
||||||
Value: ethconfig.Defaults.LightPeers,
|
|
||||||
}
|
|
||||||
|
|
||||||
// (Deprecated April 2020)
|
|
||||||
LegacyTestnetFlag = cli.BoolFlag{ // TODO(q9f): Remove after Ropsten is discontinued.
|
|
||||||
Name: "testnet",
|
|
||||||
Usage: "Pre-configured test network (Deprecated: Please choose one of --goerli, --rinkeby, or --ropsten.)",
|
|
||||||
}
|
|
||||||
|
|
||||||
// (Deprecated May 2020, shown in aliased flags section)
|
// (Deprecated May 2020, shown in aliased flags section)
|
||||||
LegacyRPCEnabledFlag = cli.BoolFlag{
|
LegacyRPCEnabledFlag = cli.BoolFlag{
|
||||||
Name: "rpc",
|
Name: "rpc",
|
||||||
Usage: "Enable the HTTP-RPC server (deprecated, use --http)",
|
Usage: "Enable the HTTP-RPC server (deprecated and will be removed June 2021, use --http)",
|
||||||
}
|
}
|
||||||
LegacyRPCListenAddrFlag = cli.StringFlag{
|
LegacyRPCListenAddrFlag = cli.StringFlag{
|
||||||
Name: "rpcaddr",
|
Name: "rpcaddr",
|
||||||
Usage: "HTTP-RPC server listening interface (deprecated, use --http.addr)",
|
Usage: "HTTP-RPC server listening interface (deprecated and will be removed June 2021, use --http.addr)",
|
||||||
Value: node.DefaultHTTPHost,
|
Value: node.DefaultHTTPHost,
|
||||||
}
|
}
|
||||||
LegacyRPCPortFlag = cli.IntFlag{
|
LegacyRPCPortFlag = cli.IntFlag{
|
||||||
Name: "rpcport",
|
Name: "rpcport",
|
||||||
Usage: "HTTP-RPC server listening port (deprecated, use --http.port)",
|
Usage: "HTTP-RPC server listening port (deprecated and will be removed June 2021, use --http.port)",
|
||||||
Value: node.DefaultHTTPPort,
|
Value: node.DefaultHTTPPort,
|
||||||
}
|
}
|
||||||
LegacyRPCCORSDomainFlag = cli.StringFlag{
|
LegacyRPCCORSDomainFlag = cli.StringFlag{
|
||||||
Name: "rpccorsdomain",
|
Name: "rpccorsdomain",
|
||||||
Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced) (deprecated, use --http.corsdomain)",
|
Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced) (deprecated and will be removed June 2021, use --http.corsdomain)",
|
||||||
Value: "",
|
Value: "",
|
||||||
}
|
}
|
||||||
LegacyRPCVirtualHostsFlag = cli.StringFlag{
|
LegacyRPCVirtualHostsFlag = cli.StringFlag{
|
||||||
Name: "rpcvhosts",
|
Name: "rpcvhosts",
|
||||||
Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (deprecated, use --http.vhosts)",
|
Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (deprecated and will be removed June 2021, use --http.vhosts)",
|
||||||
Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","),
|
Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","),
|
||||||
}
|
}
|
||||||
LegacyRPCApiFlag = cli.StringFlag{
|
LegacyRPCApiFlag = cli.StringFlag{
|
||||||
Name: "rpcapi",
|
Name: "rpcapi",
|
||||||
Usage: "API's offered over the HTTP-RPC interface (deprecated, use --http.api)",
|
Usage: "API's offered over the HTTP-RPC interface (deprecated and will be removed June 2021, use --http.api)",
|
||||||
Value: "",
|
Value: "",
|
||||||
}
|
}
|
||||||
LegacyWSListenAddrFlag = cli.StringFlag{
|
|
||||||
Name: "wsaddr",
|
|
||||||
Usage: "WS-RPC server listening interface (deprecated, use --ws.addr)",
|
|
||||||
Value: node.DefaultWSHost,
|
|
||||||
}
|
|
||||||
LegacyWSPortFlag = cli.IntFlag{
|
|
||||||
Name: "wsport",
|
|
||||||
Usage: "WS-RPC server listening port (deprecated, use --ws.port)",
|
|
||||||
Value: node.DefaultWSPort,
|
|
||||||
}
|
|
||||||
LegacyWSApiFlag = cli.StringFlag{
|
|
||||||
Name: "wsapi",
|
|
||||||
Usage: "API's offered over the WS-RPC interface (deprecated, use --ws.api)",
|
|
||||||
Value: "",
|
|
||||||
}
|
|
||||||
LegacyWSAllowedOriginsFlag = cli.StringFlag{
|
|
||||||
Name: "wsorigins",
|
|
||||||
Usage: "Origins from which to accept websockets requests (deprecated, use --ws.origins)",
|
|
||||||
Value: "",
|
|
||||||
}
|
|
||||||
LegacyGpoBlocksFlag = cli.IntFlag{
|
|
||||||
Name: "gpoblocks",
|
|
||||||
Usage: "Number of recent blocks to check for gas prices (deprecated, use --gpo.blocks)",
|
|
||||||
Value: ethconfig.Defaults.GPO.Blocks,
|
|
||||||
}
|
|
||||||
LegacyGpoPercentileFlag = cli.IntFlag{
|
|
||||||
Name: "gpopercentile",
|
|
||||||
Usage: "Suggested gas price is the given percentile of a set of recent transaction gas prices (deprecated, use --gpo.percentile)",
|
|
||||||
Value: ethconfig.Defaults.GPO.Percentile,
|
|
||||||
}
|
|
||||||
LegacyBootnodesV4Flag = cli.StringFlag{
|
|
||||||
Name: "bootnodesv4",
|
|
||||||
Usage: "Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes) (deprecated, use --bootnodes)",
|
|
||||||
Value: "",
|
|
||||||
}
|
|
||||||
LegacyBootnodesV5Flag = cli.StringFlag{
|
|
||||||
Name: "bootnodesv5",
|
|
||||||
Usage: "Comma separated enode URLs for P2P v5 discovery bootstrap (light server, light nodes) (deprecated, use --bootnodes)",
|
|
||||||
Value: "",
|
|
||||||
}
|
|
||||||
|
|
||||||
// (Deprecated July 2020, shown in aliased flags section)
|
|
||||||
LegacyGraphQLListenAddrFlag = cli.StringFlag{
|
|
||||||
Name: "graphql.addr",
|
|
||||||
Usage: "GraphQL server listening interface (deprecated, graphql can only be enabled on the HTTP-RPC server endpoint, use --graphql)",
|
|
||||||
}
|
|
||||||
LegacyGraphQLPortFlag = cli.IntFlag{
|
|
||||||
Name: "graphql.port",
|
|
||||||
Usage: "GraphQL server listening port (deprecated, graphql can only be enabled on the HTTP-RPC server endpoint, use --graphql)",
|
|
||||||
Value: node.DefaultHTTPPort,
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// showDeprecated displays deprecated flags that will be soon removed from the codebase.
|
// showDeprecated displays deprecated flags that will be soon removed from the codebase.
|
||||||
@ -179,8 +74,7 @@ func showDeprecated(*cli.Context) {
|
|||||||
fmt.Println("The following flags are deprecated and will be removed in the future!")
|
fmt.Println("The following flags are deprecated and will be removed in the future!")
|
||||||
fmt.Println("--------------------------------------------------------------------")
|
fmt.Println("--------------------------------------------------------------------")
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
|
// TODO remove when there are newly deprecated flags
|
||||||
for _, flag := range DeprecatedFlags {
|
fmt.Println("no deprecated flags to show at this time")
|
||||||
fmt.Println(flag.String())
|
fmt.Println()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -90,30 +90,6 @@ var (
|
|||||||
Name: "trace",
|
Name: "trace",
|
||||||
Usage: "Write execution trace to the given file",
|
Usage: "Write execution trace to the given file",
|
||||||
}
|
}
|
||||||
// (Deprecated April 2020)
|
|
||||||
legacyPprofPortFlag = cli.IntFlag{
|
|
||||||
Name: "pprofport",
|
|
||||||
Usage: "pprof HTTP server listening port (deprecated, use --pprof.port)",
|
|
||||||
Value: 6060,
|
|
||||||
}
|
|
||||||
legacyPprofAddrFlag = cli.StringFlag{
|
|
||||||
Name: "pprofaddr",
|
|
||||||
Usage: "pprof HTTP server listening interface (deprecated, use --pprof.addr)",
|
|
||||||
Value: "127.0.0.1",
|
|
||||||
}
|
|
||||||
legacyMemprofilerateFlag = cli.IntFlag{
|
|
||||||
Name: "memprofilerate",
|
|
||||||
Usage: "Turn on memory profiling with the given rate (deprecated, use --pprof.memprofilerate)",
|
|
||||||
Value: runtime.MemProfileRate,
|
|
||||||
}
|
|
||||||
legacyBlockprofilerateFlag = cli.IntFlag{
|
|
||||||
Name: "blockprofilerate",
|
|
||||||
Usage: "Turn on block profiling with the given rate (deprecated, use --pprof.blockprofilerate)",
|
|
||||||
}
|
|
||||||
legacyCpuprofileFlag = cli.StringFlag{
|
|
||||||
Name: "cpuprofile",
|
|
||||||
Usage: "Write CPU profile to the given file (deprecated, use --pprof.cpuprofile)",
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Flags holds all command-line flags required for debugging.
|
// Flags holds all command-line flags required for debugging.
|
||||||
@ -123,12 +99,9 @@ var Flags = []cli.Flag{
|
|||||||
blockprofilerateFlag, cpuprofileFlag, traceFlag,
|
blockprofilerateFlag, cpuprofileFlag, traceFlag,
|
||||||
}
|
}
|
||||||
|
|
||||||
var DeprecatedFlags = []cli.Flag{
|
var (
|
||||||
legacyPprofPortFlag, legacyPprofAddrFlag, legacyMemprofilerateFlag,
|
glogger *log.GlogHandler
|
||||||
legacyBlockprofilerateFlag, legacyCpuprofileFlag,
|
)
|
||||||
}
|
|
||||||
|
|
||||||
var glogger *log.GlogHandler
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
glogger = log.NewGlogHandler(log.StreamHandler(os.Stderr, log.TerminalFormat(false)))
|
glogger = log.NewGlogHandler(log.StreamHandler(os.Stderr, log.TerminalFormat(false)))
|
||||||
@ -159,16 +132,8 @@ func Setup(ctx *cli.Context) error {
|
|||||||
log.Root().SetHandler(glogger)
|
log.Root().SetHandler(glogger)
|
||||||
|
|
||||||
// profiling, tracing
|
// profiling, tracing
|
||||||
if ctx.GlobalIsSet(legacyMemprofilerateFlag.Name) {
|
|
||||||
runtime.MemProfileRate = ctx.GlobalInt(legacyMemprofilerateFlag.Name)
|
|
||||||
log.Warn("The flag --memprofilerate is deprecated and will be removed in the future, please use --pprof.memprofilerate")
|
|
||||||
}
|
|
||||||
runtime.MemProfileRate = ctx.GlobalInt(memprofilerateFlag.Name)
|
runtime.MemProfileRate = ctx.GlobalInt(memprofilerateFlag.Name)
|
||||||
|
|
||||||
if ctx.GlobalIsSet(legacyBlockprofilerateFlag.Name) {
|
|
||||||
Handler.SetBlockProfileRate(ctx.GlobalInt(legacyBlockprofilerateFlag.Name))
|
|
||||||
log.Warn("The flag --blockprofilerate is deprecated and will be removed in the future, please use --pprof.blockprofilerate")
|
|
||||||
}
|
|
||||||
Handler.SetBlockProfileRate(ctx.GlobalInt(blockprofilerateFlag.Name))
|
Handler.SetBlockProfileRate(ctx.GlobalInt(blockprofilerateFlag.Name))
|
||||||
|
|
||||||
if traceFile := ctx.GlobalString(traceFlag.Name); traceFile != "" {
|
if traceFile := ctx.GlobalString(traceFlag.Name); traceFile != "" {
|
||||||
@ -182,26 +147,12 @@ func Setup(ctx *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if cpuFile := ctx.GlobalString(legacyCpuprofileFlag.Name); cpuFile != "" {
|
|
||||||
log.Warn("The flag --cpuprofile is deprecated and will be removed in the future, please use --pprof.cpuprofile")
|
|
||||||
if err := Handler.StartCPUProfile(cpuFile); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// pprof server
|
// pprof server
|
||||||
if ctx.GlobalBool(pprofFlag.Name) {
|
if ctx.GlobalBool(pprofFlag.Name) {
|
||||||
listenHost := ctx.GlobalString(pprofAddrFlag.Name)
|
listenHost := ctx.GlobalString(pprofAddrFlag.Name)
|
||||||
if ctx.GlobalIsSet(legacyPprofAddrFlag.Name) && !ctx.GlobalIsSet(pprofAddrFlag.Name) {
|
|
||||||
listenHost = ctx.GlobalString(legacyPprofAddrFlag.Name)
|
|
||||||
log.Warn("The flag --pprofaddr is deprecated and will be removed in the future, please use --pprof.addr")
|
|
||||||
}
|
|
||||||
|
|
||||||
port := ctx.GlobalInt(pprofPortFlag.Name)
|
port := ctx.GlobalInt(pprofPortFlag.Name)
|
||||||
if ctx.GlobalIsSet(legacyPprofPortFlag.Name) && !ctx.GlobalIsSet(pprofPortFlag.Name) {
|
|
||||||
port = ctx.GlobalInt(legacyPprofPortFlag.Name)
|
|
||||||
log.Warn("The flag --pprofport is deprecated and will be removed in the future, please use --pprof.port")
|
|
||||||
}
|
|
||||||
|
|
||||||
address := fmt.Sprintf("%s:%d", listenHost, port)
|
address := fmt.Sprintf("%s:%d", listenHost, port)
|
||||||
// This context value ("metrics.addr") represents the utils.MetricsHTTPFlag.Name.
|
// This context value ("metrics.addr") represents the utils.MetricsHTTPFlag.Name.
|
||||||
|
Loading…
Reference in New Issue
Block a user