aboutsummaryrefslogtreecommitdiffstats
path: root/miner/worker.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-05 16:14:58 +0800
committerobscuren <geffobscura@gmail.com>2015-03-05 16:14:58 +0800
commitc47866d25174bd783ee6bcd5b400d81d7bf598bb (patch)
tree01c71c40981f4f75e1721011006d2da96dfc3c2d /miner/worker.go
parent15f491e5007d1507f20d0edce36cc9c0bd5cbd37 (diff)
downloaddexon-c47866d25174bd783ee6bcd5b400d81d7bf598bb.tar.gz
dexon-c47866d25174bd783ee6bcd5b400d81d7bf598bb.tar.zst
dexon-c47866d25174bd783ee6bcd5b400d81d7bf598bb.zip
Miner fixes and updates (including miner)
Diffstat (limited to 'miner/worker.go')
-rw-r--r--miner/worker.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/miner/worker.go b/miner/worker.go
index 38fc81ea5..29992b327 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -7,6 +7,7 @@ import (
"sync"
"time"
+ "github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
@@ -138,7 +139,7 @@ out:
}
break out
case <-timer.C:
- minerlogger.Debugln("Hash rate:", self.HashRate(), "Khash")
+ minerlogger.Infoln("Hash rate:", self.HashRate(), "Khash")
}
}
@@ -164,7 +165,6 @@ func (self *worker) wait() {
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()
}
@@ -190,7 +190,11 @@ func (self *worker) commitNewWork() {
self.mu.Lock()
defer self.mu.Unlock()
- self.current = env(self.chain.NewBlock(self.coinbase), self.eth)
+ block := self.chain.NewBlock(self.coinbase)
+ seednum := ethash.GetSeedBlockNum(block.NumberU64())
+ block.Header().SeedHash = self.chain.GetBlockByNumber(seednum).SeedHash()
+
+ self.current = env(block, self.eth)
parent := self.chain.GetBlock(self.current.block.ParentHash())
self.current.coinbase.SetGasPool(core.CalcGasLimit(parent, self.current.block))