Skip to content

Commit

Permalink
miner: start a newly registered agent if the miner is running. Closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
obscuren committed Apr 15, 2015
1 parent 52c874a commit ec6cbb9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@ func (self *Miner) Start(coinbase common.Address) {
}

func (self *Miner) Register(agent Agent) {
if self.mining {
agent.Start()
}

self.worker.register(agent)
}

func (self *Miner) Stop() {
self.mining = false
self.worker.stop()

//self.pow.(*ethash.Ethash).Stop()
}

func (self *Miner) HashRate() int64 {
Expand Down
6 changes: 5 additions & 1 deletion miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ func (self *worker) push() {
for _, agent := range self.agents {
atomic.AddInt64(&self.atWork, 1)

agent.Work() <- self.current.block.Copy()
if agent.Work() != nil {
agent.Work() <- self.current.block.Copy()
} else {
common.Report(fmt.Sprintf("%v %T\n", agent, agent))
}
}
}
}
Expand Down

0 comments on commit ec6cbb9

Please sign in to comment.