aboutsummaryrefslogtreecommitdiffstats
path: root/miner/miner.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-10 00:55:01 +0800
committerobscuren <geffobscura@gmail.com>2015-03-10 00:55:01 +0800
commit8560004f380dc688a1171ad5aeffa593aae41193 (patch)
treefea395acf042b51e97a86e2c4cbcf8c16b2912b7 /miner/miner.go
parent9723191b19f6ddc12f0c3376ede7529b2d72e6a2 (diff)
parent676a0de58d3d7c508b0eeeff192d2095a46f7382 (diff)
downloadgo-tangerine-8560004f380dc688a1171ad5aeffa593aae41193.tar
go-tangerine-8560004f380dc688a1171ad5aeffa593aae41193.tar.gz
go-tangerine-8560004f380dc688a1171ad5aeffa593aae41193.tar.bz2
go-tangerine-8560004f380dc688a1171ad5aeffa593aae41193.tar.lz
go-tangerine-8560004f380dc688a1171ad5aeffa593aae41193.tar.xz
go-tangerine-8560004f380dc688a1171ad5aeffa593aae41193.tar.zst
go-tangerine-8560004f380dc688a1171ad5aeffa593aae41193.zip
wip
Diffstat (limited to 'miner/miner.go')
-rw-r--r--miner/miner.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/miner/miner.go b/miner/miner.go
index 6b416be8e..d3b1f578a 100644
--- a/miner/miner.go
+++ b/miner/miner.go
@@ -3,9 +3,10 @@ package miner
import (
"math/big"
+ "github.com/ethereum/ethash"
"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 +19,20 @@ 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,
}
+ minerThreads = 1
for i := 0; i < minerThreads; i++ {
- miner.worker.register(NewCpuMiner(i, ezp.New()))
+ miner.worker.register(NewCpuMiner(i, miner.pow))
}
return miner
@@ -40,6 +45,8 @@ func (self *Miner) Mining() bool {
func (self *Miner) Start() {
self.mining = true
+ self.pow.(*ethash.Ethash).UpdateDAG()
+
self.worker.start()
self.worker.commitNewWork()
@@ -49,6 +56,8 @@ func (self *Miner) Stop() {
self.mining = false
self.worker.stop()
+
+ //self.pow.(*ethash.Ethash).Stop()
}
func (self *Miner) HashRate() int64 {