diff --git a/cmd/tomo/main.go b/cmd/tomo/main.go index 417015af645f..b2036adab8e0 100644 --- a/cmd/tomo/main.go +++ b/cmd/tomo/main.go @@ -99,8 +99,8 @@ var ( utils.MaxPendingPeersFlag, utils.EtherbaseFlag, utils.GasPriceFlag, - utils.MinerThreadsFlag, - utils.MiningEnabledFlag, + utils.StakerThreadsFlag, + utils.StakingEnabledFlag, utils.TargetGasLimitFlag, utils.NATFlag, utils.NoDiscoverFlag, @@ -283,10 +283,10 @@ func startNode(ctx *cli.Context, stack *node.Node) { } }() // Start auxiliary services if enabled - if ctx.GlobalBool(utils.MiningEnabledFlag.Name) || ctx.GlobalBool(utils.DeveloperFlag.Name) { + if ctx.GlobalBool(utils.StakingEnabledFlag.Name) || ctx.GlobalBool(utils.DeveloperFlag.Name) { // Mining only makes sense if a full Ethereum node is running if ctx.GlobalBool(utils.LightModeFlag.Name) || ctx.GlobalString(utils.SyncModeFlag.Name) == "light" { - utils.Fatalf("Light clients do not support mining") + utils.Fatalf("Light clients do not support staking") } var ethereum *eth.Ethereum if err := stack.Service(ðereum); err != nil { @@ -299,9 +299,9 @@ func startNode(ctx *cli.Context, stack *node.Node) { utils.Fatalf("Can't verify validator permission: %v", err) } if ok { - log.Info("Validator found. Enabling mining mode...") + log.Info("Validator found. Enabling staking mode...") // Use a reduced number of threads if requested - if threads := ctx.GlobalInt(utils.MinerThreadsFlag.Name); threads > 0 { + if threads := ctx.GlobalInt(utils.StakerThreadsFlag.Name); threads > 0 { type threaded interface { SetThreads(threads int) } @@ -315,7 +315,7 @@ func startNode(ctx *cli.Context, stack *node.Node) { utils.Fatalf("Failed to start staking: %v", err) } started = true - log.Info("Enabled mining node!!!") + log.Info("Enabled staking node!!!") } defer close(core.CheckpointCh) defer close(core.M1Ch) @@ -329,15 +329,15 @@ func startNode(ctx *cli.Context, stack *node.Node) { } if !ok { if started { - log.Info("Only masternode can propose and verify blocks. Cancelling mining on this node...") - ethereum.StopMining() + log.Info("Only masternode can propose and verify blocks. Cancelling staking on this node...") + ethereum.StopStaking() started = false log.Info("Cancelled mining mode!!!") } } else if !started { - log.Info("Masternode found. Enabling mining mode...") + log.Info("Masternode found. Enabling staking mode...") // Use a reduced number of threads if requested - if threads := ctx.GlobalInt(utils.MinerThreadsFlag.Name); threads > 0 { + if threads := ctx.GlobalInt(utils.StakerThreadsFlag.Name); threads > 0 { type threaded interface { SetThreads(threads int) } @@ -348,10 +348,10 @@ func startNode(ctx *cli.Context, stack *node.Node) { // Set the gas price to the limits from the CLI and start mining ethereum.TxPool().SetGasPrice(utils.GlobalBig(ctx, utils.GasPriceFlag.Name)) if err := ethereum.StartStaking(true); err != nil { - utils.Fatalf("Failed to start mining: %v", err) + utils.Fatalf("Failed to start staking: %v", err) } started = true - log.Info("Enabled mining node!!!") + log.Info("Enabled staking node!!!") } case <-core.M1Ch: log.Info("It's time to update new set of masternodes for the next epoch...") diff --git a/cmd/tomo/usage.go b/cmd/tomo/usage.go index 6d5ede210dc5..f2750564d627 100644 --- a/cmd/tomo/usage.go +++ b/cmd/tomo/usage.go @@ -182,8 +182,8 @@ var AppHelpFlagGroups = []flagGroup{ { Name: "MINER", Flags: []cli.Flag{ - utils.MiningEnabledFlag, - utils.MinerThreadsFlag, + utils.StakingEnabledFlag, + utils.StakerThreadsFlag, utils.EtherbaseFlag, utils.TargetGasLimitFlag, utils.GasPriceFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 674c2b5f4460..998db9dccfe1 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -311,13 +311,13 @@ var ( Value: int(state.MaxTrieCacheGen), } // Miner settings - MiningEnabledFlag = cli.BoolFlag{ + StakingEnabledFlag = cli.BoolFlag{ Name: "mine", - Usage: "Enable mining", + Usage: "Enable staking", } - MinerThreadsFlag = cli.IntFlag{ + StakerThreadsFlag = cli.IntFlag{ Name: "minerthreads", - Usage: "Number of CPU threads to use for mining", + Usage: "Number of CPU threads to use for staking", Value: runtime.NumCPU(), } TargetGasLimitFlag = cli.Uint64Flag{ @@ -1054,8 +1054,8 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheGCFlag.Name) { cfg.TrieCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheGCFlag.Name) / 100 } - if ctx.GlobalIsSet(MinerThreadsFlag.Name) { - cfg.MinerThreads = ctx.GlobalInt(MinerThreadsFlag.Name) + if ctx.GlobalIsSet(StakerThreadsFlag.Name) { + cfg.MinerThreads = ctx.GlobalInt(StakerThreadsFlag.Name) } if ctx.GlobalIsSet(DocRootFlag.Name) { cfg.DocRoot = ctx.GlobalString(DocRootFlag.Name) diff --git a/eth/api.go b/eth/api.go index 24f8f7aaa545..c0dff79341dd 100644 --- a/eth/api.go +++ b/eth/api.go @@ -81,7 +81,7 @@ func NewPublicMinerAPI(e *Ethereum) *PublicMinerAPI { // Mining returns an indication if this node is currently mining. func (api *PublicMinerAPI) Mining() bool { - return api.e.IsMining() + return api.e.IsStaking() } // SubmitWork can be used by external miner to submit their POW solution. It returns an indication if the work was @@ -95,7 +95,7 @@ func (api *PublicMinerAPI) SubmitWork(nonce types.BlockNonce, solution, digest c // result[1], 32 bytes hex encoded seed hash used for DAG // result[2], 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty func (api *PublicMinerAPI) GetWork() ([3]string, error) { - if !api.e.IsMining() { + if !api.e.IsStaking() { if err := api.e.StartStaking(false); err != nil { return [3]string{}, err } @@ -145,7 +145,7 @@ func (api *PrivateMinerAPI) Start(threads *int) error { th.SetThreads(*threads) } // Start the miner and return - if !api.e.IsMining() { + if !api.e.IsStaking() { // Propagate the initial price point to the transaction pool api.e.lock.RLock() price := api.e.gasPrice @@ -165,7 +165,7 @@ func (api *PrivateMinerAPI) Stop() bool { if th, ok := api.e.engine.(threaded); ok { th.SetThreads(-1) } - api.e.StopMining() + api.e.StopStaking() return true } diff --git a/eth/backend.go b/eth/backend.go index 0931d447c9f8..c8247bdab365 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -471,8 +471,8 @@ func (s *Ethereum) StartStaking(local bool) error { return nil } -func (s *Ethereum) StopMining() { s.miner.Stop() } -func (s *Ethereum) IsMining() bool { return s.miner.Mining() } +func (s *Ethereum) StopStaking() { s.miner.Stop() } +func (s *Ethereum) IsStaking() bool { return s.miner.Mining() } func (s *Ethereum) Miner() *miner.Miner { return s.miner } func (s *Ethereum) AccountManager() *accounts.Manager { return s.accountManager }