aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/geth/main.go')
-rw-r--r--cmd/geth/main.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index cc6d3ac6a..e942d53c8 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -303,7 +303,15 @@ func startNode(ctx *cli.Context, stack *node.Node) {
if err := stack.Service(&ethereum); err != nil {
utils.Fatalf("ethereum service not running: %v", err)
}
- if err := ethereum.StartMining(ctx.GlobalInt(utils.MinerThreadsFlag.Name)); err != nil {
+ if threads := ctx.GlobalInt(utils.MinerThreadsFlag.Name); threads > 0 {
+ type threaded interface {
+ SetThreads(threads int)
+ }
+ if th, ok := ethereum.Engine().(threaded); ok {
+ th.SetThreads(threads)
+ }
+ }
+ if err := ethereum.StartMining(); err != nil {
utils.Fatalf("Failed to start mining: %v", err)
}
}