diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-05-14 19:05:27 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-05-14 19:05:27 +0800 |
commit | c7a13c9be86417848582a2ab6704586f92dff27c (patch) | |
tree | a1e7634f3980a5d0adf85d8d3ee7ff7cae8d3a6b /miner | |
parent | 2b06fe3eff50c117db88a3184c7851f62bb14b9d (diff) | |
parent | b24f16fa532483e0714700d687f134fb373f2487 (diff) | |
download | dexon-c7a13c9be86417848582a2ab6704586f92dff27c.tar.gz dexon-c7a13c9be86417848582a2ab6704586f92dff27c.tar.zst dexon-c7a13c9be86417848582a2ab6704586f92dff27c.zip |
Merge pull request #969 from Gustav-Simonsson/ethash_improve_hashrate_update2
Make read of ethash hashrate atomic and update ethash godep
Diffstat (limited to 'miner')
-rw-r--r-- | miner/miner.go | 2 | ||||
-rw-r--r-- | miner/worker.go | 9 |
2 files changed, 3 insertions, 8 deletions
diff --git a/miner/miner.go b/miner/miner.go index 09342e250..8143fcef7 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -70,7 +70,7 @@ func (self *Miner) Register(agent Agent) { } func (self *Miner) HashRate() int64 { - return self.worker.HashRate() + return self.pow.GetHashrate() } func (self *Miner) SetExtra(extra []byte) { diff --git a/miner/worker.go b/miner/worker.go index c70ded434..d5f9dd8c5 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -175,7 +175,6 @@ func (self *worker) stop() { func (self *worker) register(agent Agent) { self.mu.Lock() defer self.mu.Unlock() - self.agents = append(self.agents, agent) agent.SetReturnCh(self.recv) } @@ -459,13 +458,9 @@ func (self *worker) commitTransaction(tx *types.Transaction) error { return nil } +// TODO: remove or use func (self *worker) HashRate() int64 { - var tot int64 - for _, agent := range self.agents { - tot += agent.GetHashRate() - } - - return tot + return 0 } // gasprice calculates a reduced gas price based on the pct |