diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-20 03:45:40 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-20 03:45:40 +0800 |
commit | 2c1a6a349b4f8bb23e37a75d8d8ceaa0fbfced8d (patch) | |
tree | fd32a029985128ffa8a0c0581c063d46b94954d2 /miner/miner.go | |
parent | ed07ffcde5ab661a9fd41045c5ec102e7839001c (diff) | |
download | go-tangerine-2c1a6a349b4f8bb23e37a75d8d8ceaa0fbfced8d.tar go-tangerine-2c1a6a349b4f8bb23e37a75d8d8ceaa0fbfced8d.tar.gz go-tangerine-2c1a6a349b4f8bb23e37a75d8d8ceaa0fbfced8d.tar.bz2 go-tangerine-2c1a6a349b4f8bb23e37a75d8d8ceaa0fbfced8d.tar.lz go-tangerine-2c1a6a349b4f8bb23e37a75d8d8ceaa0fbfced8d.tar.xz go-tangerine-2c1a6a349b4f8bb23e37a75d8d8ceaa0fbfced8d.tar.zst go-tangerine-2c1a6a349b4f8bb23e37a75d8d8ceaa0fbfced8d.zip |
miner: removed default timer & update dag when threads > 0
Diffstat (limited to 'miner/miner.go')
-rw-r--r-- | miner/miner.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/miner/miner.go b/miner/miner.go index a14a195d2..883956370 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -16,9 +16,10 @@ type Miner struct { MinAcceptedGasPrice *big.Int - mining bool - eth core.Backend - pow pow.PoW + threads int + mining bool + eth core.Backend + pow pow.PoW } func New(eth core.Backend, pow pow.PoW, minerThreads int) *Miner { @@ -28,6 +29,7 @@ func New(eth core.Backend, pow pow.PoW, minerThreads int) *Miner { for i := 0; i < minerThreads; i++ { miner.worker.register(NewCpuMiner(i, pow)) } + miner.threads = minerThreads return miner } @@ -40,7 +42,9 @@ func (self *Miner) Start(coinbase common.Address) { self.mining = true self.worker.coinbase = coinbase - self.pow.(*ethash.Ethash).UpdateDAG() + if self.threads > 0 { + self.pow.(*ethash.Ethash).UpdateDAG() + } self.worker.start() |