diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-24 17:34:06 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-24 17:34:06 +0800 |
commit | a59ea7ce297d2bb26cee9ff295f622697645e49c (patch) | |
tree | 13c6feda5b05430911ebbc5492a485dfd59c54ae /miner/miner.go | |
parent | d8e21b39b30f3951c17a618baffcc3592afae0b1 (diff) | |
download | dexon-a59ea7ce297d2bb26cee9ff295f622697645e49c.tar.gz dexon-a59ea7ce297d2bb26cee9ff295f622697645e49c.tar.zst dexon-a59ea7ce297d2bb26cee9ff295f622697645e49c.zip |
Changed miner
* Instead of delivering `Work` to the `Worker`, push a complete Block to
the `Worker` so that each agent can work on their own block.
Diffstat (limited to 'miner/miner.go')
-rw-r--r-- | miner/miner.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/miner/miner.go b/miner/miner.go index d46fabc1e..cf84c11f3 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -26,7 +26,11 @@ 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, worker: newWorker(common.Address{}, eth)} + miner := &Miner{eth: eth, pow: pow, worker: newWorker(common.Address{}, eth)} + for i := 0; i < minerThreads; i++ { + miner.worker.register(NewCpuMiner(i, pow)) + } + return miner } func (self *Miner) Mining() bool { @@ -36,7 +40,6 @@ func (self *Miner) Mining() bool { func (self *Miner) Start(coinbase common.Address) { self.mining = true self.worker.coinbase = coinbase - self.worker.register(NewCpuMiner(0, self.pow)) self.pow.(*ethash.Ethash).UpdateDAG() |