aboutsummaryrefslogtreecommitdiffstats
path: root/consensus/ethash/ethash.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-04-09 01:40:54 +0800
committerGitHub <noreply@github.com>2017-04-09 01:40:54 +0800
commitbadbaf66b6efe454ac02d0a6ce1ae964f7fa67c0 (patch)
treeffa8ffe28b6e7539cfd9baa6aa0b3c48522b91fc /consensus/ethash/ethash.go
parentcc13d576f07fb6803e09fb42880591a67b8b0ef6 (diff)
parentb801be99d47ba09121a3e7d14aa028f828525b61 (diff)
downloaddexon-badbaf66b6efe454ac02d0a6ce1ae964f7fa67c0.tar.gz
dexon-badbaf66b6efe454ac02d0a6ce1ae964f7fa67c0.tar.zst
dexon-badbaf66b6efe454ac02d0a6ce1ae964f7fa67c0.zip
Merge pull request #13880 from karalabe/remote-miner-fix
consensus/ethash, eth: don't mine if 0 threads are set
Diffstat (limited to 'consensus/ethash/ethash.go')
-rw-r--r--consensus/ethash/ethash.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/consensus/ethash/ethash.go b/consensus/ethash/ethash.go
index aa5b2d8a0..d284e7b00 100644
--- a/consensus/ethash/ethash.go
+++ b/consensus/ethash/ethash.go
@@ -555,11 +555,18 @@ func (ethash *Ethash) Threads() int {
// SetThreads updates the number of mining threads currently enabled. Calling
// this method does not start mining, only sets the thread count. If zero is
-// specified, the miner will use all cores of the machine.
+// specified, the miner will use all cores of the machine. Setting a thread
+// count below zero is allowed and will cause the miner to idle, without any
+// work being done.
func (ethash *Ethash) SetThreads(threads int) {
ethash.lock.Lock()
defer ethash.lock.Unlock()
+ // If we're running a shared PoW, set the thread count on that instead
+ if ethash.shared != nil {
+ ethash.shared.SetThreads(threads)
+ return
+ }
// Update the threads and ping any running seal to pull in any changes
ethash.threads = threads
select {