aboutsummaryrefslogtreecommitdiffstats
path: root/miner/agent.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-06-16 18:41:50 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-06-30 00:51:47 +0800
commit1d42888d3047dabfb352c94a2051e7af14d2a509 (patch)
tree8ca68ca98bd697f26f2033a5480e78ccbf064162 /miner/agent.go
parent654564e164b3b6f7f4ba1e8bbd6fcd64776068fa (diff)
downloadgo-tangerine-1d42888d3047dabfb352c94a2051e7af14d2a509.tar.gz
go-tangerine-1d42888d3047dabfb352c94a2051e7af14d2a509.tar.zst
go-tangerine-1d42888d3047dabfb352c94a2051e7af14d2a509.zip
core/types: make blocks immutable
Diffstat (limited to 'miner/agent.go')
-rw-r--r--miner/agent.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/miner/agent.go b/miner/agent.go
index 3ed3ba839..a7d017aa5 100644
--- a/miner/agent.go
+++ b/miner/agent.go
@@ -90,15 +90,13 @@ done:
}
}
-func (self *CpuAgent) mine(block *types.Block, stop <- chan struct{}) {
+func (self *CpuAgent) mine(block *types.Block, stop <-chan struct{}) {
glog.V(logger.Debug).Infof("(re)started agent[%d]. mining...\n", self.index)
// Mine
nonce, mixDigest := self.pow.Search(block, stop)
if nonce != 0 {
- block.SetNonce(nonce)
- block.Header().MixDigest = common.BytesToHash(mixDigest)
- self.returnCh <- block
+ self.returnCh <- block.WithMiningResult(nonce, common.BytesToHash(mixDigest))
} else {
self.returnCh <- nil
}