Get work / submit work partially implemented.

* WIP missing arguments for submitting new work
* GetWork **done**
This commit is contained in:
obscuren
2015-03-22 15:38:01 +01:00
parent 9682a3ef3e
commit 82956df523
5 changed files with 101 additions and 8 deletions

View File

@ -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()