diff options
author | obscuren <geffobscura@gmail.com> | 2015-05-22 01:53:35 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-05-22 01:53:35 +0800 |
commit | 13e662f6dec6342a488a9dad60f2093b72c14bb6 (patch) | |
tree | 9d7cfd23c1103f55ebefd80bc56ab18a0fcfca18 | |
parent | 2c1c78a6d9e59de1d4cdeb32737d281814d690f7 (diff) | |
parent | 054abe20b81ada11a820405f4a42f59cea9f9199 (diff) | |
download | go-tangerine-13e662f6dec6342a488a9dad60f2093b72c14bb6.tar go-tangerine-13e662f6dec6342a488a9dad60f2093b72c14bb6.tar.gz go-tangerine-13e662f6dec6342a488a9dad60f2093b72c14bb6.tar.bz2 go-tangerine-13e662f6dec6342a488a9dad60f2093b72c14bb6.tar.lz go-tangerine-13e662f6dec6342a488a9dad60f2093b72c14bb6.tar.xz go-tangerine-13e662f6dec6342a488a9dad60f2093b72c14bb6.tar.zst go-tangerine-13e662f6dec6342a488a9dad60f2093b72c14bb6.zip |
Merge branch 'develop'0.9.23
-rw-r--r-- | miner/miner.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/miner/miner.go b/miner/miner.go index 4e99245f8..20ca81648 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -45,6 +45,7 @@ func New(eth core.Backend, mux *event.TypeMux, pow pow.PoW) *Miner { // and halt your mining operation for as long as the DOS continues. func (self *Miner) update() { events := self.mux.Subscribe(downloader.StartEvent{}, downloader.DoneEvent{}, downloader.FailedEvent{}) +out: for ev := range events.Chan() { switch ev.(type) { case downloader.StartEvent: @@ -62,11 +63,11 @@ func (self *Miner) update() { if shouldStart { self.Start(self.coinbase, self.threads) } + // unsubscribe. we're only interested in this event once + events.Unsubscribe() + // stop immediately and ignore all further pending events + break out } - // unsubscribe. we're only interested in this event once - events.Unsubscribe() - // stop immediately and ignore all further pending events - break } } |