forked from cerc-io/plugeth
miner: moved break INSIDE the switch ...
This commit is contained in:
parent
8c25a83708
commit
054abe20b8
@ -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.
|
// and halt your mining operation for as long as the DOS continues.
|
||||||
func (self *Miner) update() {
|
func (self *Miner) update() {
|
||||||
events := self.mux.Subscribe(downloader.StartEvent{}, downloader.DoneEvent{}, downloader.FailedEvent{})
|
events := self.mux.Subscribe(downloader.StartEvent{}, downloader.DoneEvent{}, downloader.FailedEvent{})
|
||||||
|
out:
|
||||||
for ev := range events.Chan() {
|
for ev := range events.Chan() {
|
||||||
switch ev.(type) {
|
switch ev.(type) {
|
||||||
case downloader.StartEvent:
|
case downloader.StartEvent:
|
||||||
@ -62,11 +63,11 @@ func (self *Miner) update() {
|
|||||||
if shouldStart {
|
if shouldStart {
|
||||||
self.Start(self.coinbase, self.threads)
|
self.Start(self.coinbase, self.threads)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// unsubscribe. we're only interested in this event once
|
// unsubscribe. we're only interested in this event once
|
||||||
events.Unsubscribe()
|
events.Unsubscribe()
|
||||||
// stop immediately and ignore all further pending events
|
// stop immediately and ignore all further pending events
|
||||||
break
|
break out
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user