Merge pull request #851 from gzliudan/deprecate_mine_flag

cmd: deprecate the `--mine` flag
This commit is contained in:
Daniel Liu 2025-02-17 09:19:43 +08:00 committed by GitHub
commit ff0c34486a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 23 deletions

View file

@ -92,16 +92,15 @@ type Bootnodes struct {
} }
type XDCConfig struct { type XDCConfig struct {
Eth ethconfig.Config Eth ethconfig.Config
Node node.Config Node node.Config
Ethstats ethstatsConfig Ethstats ethstatsConfig
Metrics metrics.Config Metrics metrics.Config
XDCX XDCx.Config XDCX XDCx.Config
Account account Account account
StakeEnable bool Bootnodes Bootnodes
Bootnodes Bootnodes Verbosity int
Verbosity int NAT string
NAT string
} }
func loadConfig(file string, cfg *XDCConfig) error { func loadConfig(file string, cfg *XDCConfig) error {
@ -132,13 +131,12 @@ func defaultNodeConfig() node.Config {
func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) { func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) {
// Load defaults. // Load defaults.
cfg := XDCConfig{ cfg := XDCConfig{
Eth: ethconfig.Defaults, Eth: ethconfig.Defaults,
XDCX: XDCx.DefaultConfig, XDCX: XDCx.DefaultConfig,
Node: defaultNodeConfig(), Node: defaultNodeConfig(),
Metrics: metrics.DefaultConfig, Metrics: metrics.DefaultConfig,
StakeEnable: true, Verbosity: 3,
Verbosity: 3, NAT: "",
NAT: "",
} }
// Load config file. // Load config file.
if file := ctx.String(configFileFlag.Name); file != "" { if file := ctx.String(configFileFlag.Name); file != "" {
@ -147,7 +145,7 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) {
} }
} }
if ctx.IsSet(utils.MiningEnabledFlag.Name) { if ctx.IsSet(utils.MiningEnabledFlag.Name) {
cfg.StakeEnable = ctx.Bool(utils.MiningEnabledFlag.Name) log.Warn("The flag --mine is deprecated and will be removed")
} }
// if !ctx.IsSet(debug.VerbosityFlag.Name) { // if !ctx.IsSet(debug.VerbosityFlag.Name) {
// debug.Verbosity(log.Lvl(cfg.Verbosity)) // debug.Verbosity(log.Lvl(cfg.Verbosity))

View file

@ -334,11 +334,6 @@ var (
} }
// Miner settings // Miner settings
MiningEnabledFlag = &cli.BoolFlag{
Name: "mine",
Usage: "Enable mining",
Category: flags.MinerCategory,
}
MinerThreadsFlag = &cli.IntFlag{ MinerThreadsFlag = &cli.IntFlag{
Name: "miner-threads", Name: "miner-threads",
Aliases: []string{"minerthreads"}, Aliases: []string{"minerthreads"},

View file

@ -37,6 +37,7 @@ var DeprecatedFlags = []cli.Flag{
NoUSBFlag, NoUSBFlag,
LogBacktraceAtFlag, LogBacktraceAtFlag,
LogDebugFlag, LogDebugFlag,
MiningEnabledFlag,
} }
var ( var (
@ -74,6 +75,12 @@ var (
Usage: "Enable expensive metrics collection and reporting (deprecated)", Usage: "Enable expensive metrics collection and reporting (deprecated)",
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }
// Deprecated February 2025
MiningEnabledFlag = &cli.BoolFlag{
Name: "mine",
Usage: "Enable mining (deprecated)",
Category: flags.DeprecatedCategory,
}
) )
// showDeprecated displays deprecated flags that will be soon removed from the codebase. // showDeprecated displays deprecated flags that will be soon removed from the codebase.