aboutsummaryrefslogtreecommitdiffstats
path: root/miner/worker.go
diff options
context:
space:
mode:
Diffstat (limited to 'miner/worker.go')
-rw-r--r--miner/worker.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/miner/worker.go b/miner/worker.go
index bc1c8e194..1388b22b0 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -46,8 +46,10 @@ func env(block *types.Block, eth core.Backend) *environment {
}
type Work struct {
- Number uint64
- Nonce []byte
+ Number uint64
+ Nonce []byte
+ MixDigest []byte
+ SeedHash []byte
}
type Agent interface {
@@ -146,17 +148,23 @@ out:
func (self *worker) wait() {
for {
for work := range self.recv {
+ // Someone Successfully Mined!
block := self.current.block
if block.Number().Uint64() == work.Number && block.Nonce() == nil {
self.current.block.Header().Nonce = work.Nonce
+ self.current.block.Header().MixDigest = work.MixDigest
+ self.current.block.Header().SeedHash = work.SeedHash
+
jsonlogger.LogJson(&logger.EthMinerNewBlock{
BlockHash: ethutil.Bytes2Hex(block.Hash()),
BlockNumber: block.Number(),
ChainHeadHash: ethutil.Bytes2Hex(block.ParentHeaderHash),
BlockPrevHash: ethutil.Bytes2Hex(block.ParentHeaderHash),
})
+
if err := self.chain.InsertChain(types.Blocks{self.current.block}); err == nil {
self.mux.Post(core.NewMinedBlockEvent{self.current.block})
+ fmt.Println("GOOD BLOCK", self.current.block)
} else {
self.commitNewWork()
}