From 92381ee00999398d0d0928d2c4be82b3334b912b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Thu, 23 Aug 2018 13:02:36 +0300 Subject: cmd, eth: clean up miner startup API, drop noop config field --- cmd/geth/main.go | 20 ++++++-------------- cmd/utils/flags.go | 6 ------ 2 files changed, 6 insertions(+), 20 deletions(-) (limited to 'cmd') diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 4b86382bd..7b8a8244e 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -336,26 +336,18 @@ func startNode(ctx *cli.Context, stack *node.Node) { if err := stack.Service(ðereum); err != nil { utils.Fatalf("Ethereum service not running: %v", err) } - // Use a reduced number of threads if requested - threads := ctx.GlobalInt(utils.MinerLegacyThreadsFlag.Name) - if ctx.GlobalIsSet(utils.MinerThreadsFlag.Name) { - threads = ctx.GlobalInt(utils.MinerThreadsFlag.Name) - } - if threads > 0 { - type threaded interface { - SetThreads(threads int) - } - if th, ok := ethereum.Engine().(threaded); ok { - th.SetThreads(threads) - } - } // Set the gas price to the limits from the CLI and start mining gasprice := utils.GlobalBig(ctx, utils.MinerLegacyGasPriceFlag.Name) if ctx.IsSet(utils.MinerGasPriceFlag.Name) { gasprice = utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name) } ethereum.TxPool().SetGasPrice(gasprice) - if err := ethereum.StartMining(true); err != nil { + + threads := ctx.GlobalInt(utils.MinerLegacyThreadsFlag.Name) + if ctx.GlobalIsSet(utils.MinerThreadsFlag.Name) { + threads = ctx.GlobalInt(utils.MinerThreadsFlag.Name) + } + if err := ethereum.StartMining(threads); err != nil { utils.Fatalf("Failed to start mining: %v", err) } } diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index c9a936dd5..b9a33ffe7 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1130,12 +1130,6 @@ 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(MinerLegacyThreadsFlag.Name) { - cfg.MinerThreads = ctx.GlobalInt(MinerLegacyThreadsFlag.Name) - } - if ctx.GlobalIsSet(MinerThreadsFlag.Name) { - cfg.MinerThreads = ctx.GlobalInt(MinerThreadsFlag.Name) - } if ctx.GlobalIsSet(MinerNotifyFlag.Name) { cfg.MinerNotify = strings.Split(ctx.GlobalString(MinerNotifyFlag.Name), ",") } -- cgit v1.2.3