aboutsummaryrefslogtreecommitdiffstats
path: root/miner/agent.go
diff options
context:
space:
mode:
Diffstat (limited to 'miner/agent.go')
-rw-r--r--miner/agent.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/miner/agent.go b/miner/agent.go
index b12b9da4d..ddd8e6675 100644
--- a/miner/agent.go
+++ b/miner/agent.go
@@ -9,7 +9,7 @@ type CpuMiner struct {
c chan *types.Block
quit chan struct{}
quitCurrentOp chan struct{}
- returnCh chan<- []byte
+ returnCh chan<- Work
index int
pow pow.PoW
@@ -28,9 +28,9 @@ func NewCpuMiner(index int, pow pow.PoW) *CpuMiner {
return miner
}
-func (self *CpuMiner) Work() chan<- *types.Block { return self.c }
-func (self *CpuMiner) Pow() pow.PoW { return self.pow }
-func (self *CpuMiner) SetNonceCh(ch chan<- []byte) { self.returnCh = ch }
+func (self *CpuMiner) Work() chan<- *types.Block { return self.c }
+func (self *CpuMiner) Pow() pow.PoW { return self.pow }
+func (self *CpuMiner) SetNonceCh(ch chan<- Work) { self.returnCh = ch }
func (self *CpuMiner) Stop() {
close(self.quit)
@@ -42,7 +42,6 @@ out:
for {
select {
case block := <-self.c:
- minerlogger.Infof("miner[%d] got block\n", self.index)
// make sure it's open
self.quitCurrentOp <- struct{}{}
@@ -66,9 +65,9 @@ done:
}
func (self *CpuMiner) mine(block *types.Block) {
- minerlogger.Infof("started agent[%d]. mining...\n", self.index)
+ minerlogger.Infof("(re)started agent[%d]. mining...\n", self.index)
nonce := self.pow.Search(block, self.quitCurrentOp)
if nonce != nil {
- self.returnCh <- nonce
+ self.returnCh <- Work{block.Number().Uint64(), nonce}
}
}