Skip to content

Commit

Permalink
Merge pull request #851 from gzliudan/deprecate_mine_flag
Browse files Browse the repository at this point in the history
cmd: deprecate the `--mine` flag
  • Loading branch information
gzliudan authored Feb 17, 2025
2 parents 5db69a7 + b50c4a2 commit ff0c344
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
34 changes: 16 additions & 18 deletions cmd/XDC/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 != "" {
Expand All @@ -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))
Expand Down
5 changes: 0 additions & 5 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
7 changes: 7 additions & 0 deletions cmd/utils/flags_legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var DeprecatedFlags = []cli.Flag{
NoUSBFlag,
LogBacktraceAtFlag,
LogDebugFlag,
MiningEnabledFlag,
}

var (
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit ff0c344

Please sign in to comment.