diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-04-05 06:16:29 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2017-04-05 06:16:29 +0800 |
commit | 09777952ee476ff80d4b6e63b5041ff5ca0e441b (patch) | |
tree | e85320f88f548201e3476b3e7095e96fd071617b /cmd/geth/main.go | |
parent | e50a5b77712d891ff409aa942a5cbc24e721b332 (diff) | |
download | dexon-09777952ee476ff80d4b6e63b5041ff5ca0e441b.tar.gz dexon-09777952ee476ff80d4b6e63b5041ff5ca0e441b.tar.zst dexon-09777952ee476ff80d4b6e63b5041ff5ca0e441b.zip |
core, consensus: pluggable consensus engines (#3817)
This commit adds pluggable consensus engines to go-ethereum. In short, it
introduces a generic consensus interface, and refactors the entire codebase to
use this interface.
Diffstat (limited to 'cmd/geth/main.go')
-rw-r--r-- | cmd/geth/main.go | 10 |
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(ðereum); 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) } } |