From 054abe20b81ada11a820405f4a42f59cea9f9199 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 21 May 2015 19:53:27 +0200 Subject: [PATCH] miner: moved break INSIDE the switch ... --- miner/miner.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/miner/miner.go b/miner/miner.go index 4e99245f8c..20ca81648a 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 } }