diff options
Diffstat (limited to 'miner')
-rw-r--r-- | miner/miner.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/miner/miner.go b/miner/miner.go index ccc19c754..d46fabc1e 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -26,7 +26,7 @@ type Miner struct { func New(eth core.Backend, pow pow.PoW, minerThreads int) *Miner { // note: minerThreads is currently ignored because // ethash is not thread safe. - return &Miner{eth: eth, pow: pow} + return &Miner{eth: eth, pow: pow, worker: newWorker(common.Address{}, eth)} } func (self *Miner) Mining() bool { @@ -35,7 +35,7 @@ func (self *Miner) Mining() bool { func (self *Miner) Start(coinbase common.Address) { self.mining = true - self.worker = newWorker(coinbase, self.eth) + self.worker.coinbase = coinbase self.worker.register(NewCpuMiner(0, self.pow)) self.pow.(*ethash.Ethash).UpdateDAG() @@ -44,6 +44,10 @@ func (self *Miner) Start(coinbase common.Address) { self.worker.commitNewWork() } +func (self *Miner) Register(agent Agent) { + self.worker.register(agent) +} + func (self *Miner) Stop() { self.mining = false self.worker.stop() |