aboutsummaryrefslogtreecommitdiffstats
path: root/miner
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-22 22:38:01 +0800
committerobscuren <geffobscura@gmail.com>2015-03-22 22:38:01 +0800
commit82956df523fd75d0c3b4a49f571eee60935fc32e (patch)
treed30856ceb5e789e90f9750601a09b595b91bd71e /miner
parent9682a3ef3ec72a871708a9bba1133fa59b58ccb5 (diff)
downloaddexon-82956df523fd75d0c3b4a49f571eee60935fc32e.tar
dexon-82956df523fd75d0c3b4a49f571eee60935fc32e.tar.gz
dexon-82956df523fd75d0c3b4a49f571eee60935fc32e.tar.bz2
dexon-82956df523fd75d0c3b4a49f571eee60935fc32e.tar.lz
dexon-82956df523fd75d0c3b4a49f571eee60935fc32e.tar.xz
dexon-82956df523fd75d0c3b4a49f571eee60935fc32e.tar.zst
dexon-82956df523fd75d0c3b4a49f571eee60935fc32e.zip
Get work / submit work partially implemented.
* WIP missing arguments for submitting new work * GetWork **done**
Diffstat (limited to 'miner')
-rw-r--r--miner/miner.go8
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()