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

View file

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

View file

@ -37,6 +37,7 @@ var DeprecatedFlags = []cli.Flag{
NoUSBFlag,
LogBacktraceAtFlag,
LogDebugFlag,
MiningEnabledFlag,
}
var (
@ -74,6 +75,12 @@ var (
Usage: "Enable expensive metrics collection and reporting (deprecated)",
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.