diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-08-23 19:17:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-23 19:17:12 +0800 |
commit | 67d6d0bb7d0e9b18334d45e2d811f00746320d65 (patch) | |
tree | 53d2c1847ad134bc88c059b70e7691396e2c5536 /cmd | |
parent | 1df1187d831a1c62f61e8c90901dc78b5f86943a (diff) | |
parent | 1e63a015a56ae45825c842b5a2b17d2cf2ac1ac6 (diff) | |
download | dexon-67d6d0bb7d0e9b18334d45e2d811f00746320d65.tar dexon-67d6d0bb7d0e9b18334d45e2d811f00746320d65.tar.gz dexon-67d6d0bb7d0e9b18334d45e2d811f00746320d65.tar.bz2 dexon-67d6d0bb7d0e9b18334d45e2d811f00746320d65.tar.lz dexon-67d6d0bb7d0e9b18334d45e2d811f00746320d65.tar.xz dexon-67d6d0bb7d0e9b18334d45e2d811f00746320d65.tar.zst dexon-67d6d0bb7d0e9b18334d45e2d811f00746320d65.zip |
Merge pull request #17492 from karalabe/eth-miner-threads-defaults
cmd, eth: clean up miner startup API, drop noop config field
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/geth/main.go | 20 | ||||
-rw-r--r-- | cmd/utils/flags.go | 6 |
2 files changed, 6 insertions, 20 deletions
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), ",") } |