aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-08-23 18:02:36 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-08-23 19:09:45 +0800
commit92381ee00999398d0d0928d2c4be82b3334b912b (patch)
treea0bdcae53eace4fbf158c706b8c3cd33831edc8c /cmd
parentf34f361ca6635690f6dd81d6f3bddfff498e9fd6 (diff)
downloaddexon-92381ee00999398d0d0928d2c4be82b3334b912b.tar.gz
dexon-92381ee00999398d0d0928d2c4be82b3334b912b.tar.zst
dexon-92381ee00999398d0d0928d2c4be82b3334b912b.zip
cmd, eth: clean up miner startup API, drop noop config field
Diffstat (limited to 'cmd')
-rw-r--r--cmd/geth/main.go20
-rw-r--r--cmd/utils/flags.go6
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(&ethereum); 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), ",")
}