aboutsummaryrefslogtreecommitdiffstats
path: root/miner
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-04 00:55:23 +0800
committerobscuren <geffobscura@gmail.com>2015-03-04 00:55:23 +0800
commit313fe3861b3c338b3b6304adac46c86af7e2d52e (patch)
treee19ace3d9fd0b8f8fe67e5f0fb934cfd407b5664 /miner
parent22b132e28f74cabef38a55874da8e3db93786144 (diff)
downloaddexon-313fe3861b3c338b3b6304adac46c86af7e2d52e.tar
dexon-313fe3861b3c338b3b6304adac46c86af7e2d52e.tar.gz
dexon-313fe3861b3c338b3b6304adac46c86af7e2d52e.tar.bz2
dexon-313fe3861b3c338b3b6304adac46c86af7e2d52e.tar.lz
dexon-313fe3861b3c338b3b6304adac46c86af7e2d52e.tar.xz
dexon-313fe3861b3c338b3b6304adac46c86af7e2d52e.tar.zst
dexon-313fe3861b3c338b3b6304adac46c86af7e2d52e.zip
fixed pow stuff
Diffstat (limited to 'miner')
-rw-r--r--miner/miner.go9
-rw-r--r--miner/worker.go1
2 files changed, 7 insertions, 3 deletions
diff --git a/miner/miner.go b/miner/miner.go
index 0cc2361c8..f207948a5 100644
--- a/miner/miner.go
+++ b/miner/miner.go
@@ -5,7 +5,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/pow/ezp"
+ "github.com/ethereum/go-ethereum/pow"
)
var minerlogger = logger.NewLogger("MINER")
@@ -18,16 +18,19 @@ type Miner struct {
Coinbase []byte
mining bool
+
+ pow pow.PoW
}
-func New(coinbase []byte, eth core.Backend, minerThreads int) *Miner {
+func New(coinbase []byte, eth core.Backend, pow pow.PoW, minerThreads int) *Miner {
miner := &Miner{
Coinbase: coinbase,
worker: newWorker(coinbase, eth),
+ pow: pow,
}
for i := 0; i < minerThreads; i++ {
- miner.worker.register(NewCpuMiner(i, ezp.New()))
+ miner.worker.register(NewCpuMiner(i, miner.pow))
}
return miner
diff --git a/miner/worker.go b/miner/worker.go
index 201367fdf..fe80b63ee 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -146,6 +146,7 @@ func (self *worker) wait() {
self.current.block.Header().Nonce = work.Nonce
self.current.block.Header().MixDigest = work.MixDigest
self.current.block.Header().SeedHash = work.SeedHash
+ fmt.Println(self.current.block)
if err := self.chain.InsertChain(types.Blocks{self.current.block}); err == nil {
self.mux.Post(core.NewMinedBlockEvent{self.current.block})