cmd: deprecate flag --mine

This commit is contained in:
Daniel Liu 2025-02-13 16:31:36 +08:00
parent 5db69a70bc
commit b50c4a29f6
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.