aboutsummaryrefslogtreecommitdiffstats
path: root/miner/miner.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-24 17:34:06 +0800
committerobscuren <geffobscura@gmail.com>2015-03-24 17:34:06 +0800
commita59ea7ce297d2bb26cee9ff295f622697645e49c (patch)
tree13c6feda5b05430911ebbc5492a485dfd59c54ae /miner/miner.go
parentd8e21b39b30f3951c17a618baffcc3592afae0b1 (diff)
downloadgo-tangerine-a59ea7ce297d2bb26cee9ff295f622697645e49c.tar
go-tangerine-a59ea7ce297d2bb26cee9ff295f622697645e49c.tar.gz
go-tangerine-a59ea7ce297d2bb26cee9ff295f622697645e49c.tar.bz2
go-tangerine-a59ea7ce297d2bb26cee9ff295f622697645e49c.tar.lz
go-tangerine-a59ea7ce297d2bb26cee9ff295f622697645e49c.tar.xz
go-tangerine-a59ea7ce297d2bb26cee9ff295f622697645e49c.tar.zst
go-tangerine-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.go7
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()