aboutsummaryrefslogtreecommitdiffstats
path: root/miner/miner.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-08-06 17:58:14 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-08-06 18:58:54 +0800
commitc32073b11f12c3735c117b3b3c814505974d5a92 (patch)
treecfe83a65139ae8160dc7d1bbed8e22c56050bfd3 /miner/miner.go
parent82ef26f6007986debd6ce082f57050f0c7e36006 (diff)
downloadgo-tangerine-c32073b11f12c3735c117b3b3c814505974d5a92.tar.gz
go-tangerine-c32073b11f12c3735c117b3b3c814505974d5a92.tar.zst
go-tangerine-c32073b11f12c3735c117b3b3c814505974d5a92.zip
miner, rpc: added submit hashrate for remote agents
Diffstat (limited to 'miner/miner.go')
-rw-r--r--miner/miner.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/miner/miner.go b/miner/miner.go
index bf6a48802..508778579 100644
--- a/miner/miner.go
+++ b/miner/miner.go
@@ -139,8 +139,15 @@ func (self *Miner) Mining() bool {
return atomic.LoadInt32(&self.mining) > 0
}
-func (self *Miner) HashRate() int64 {
- return self.pow.GetHashrate()
+func (self *Miner) HashRate() (tot int64) {
+ tot += self.pow.GetHashrate()
+ // do we care this might race? is it worth we're rewriting some
+ // aspects of the worker/locking up agents so we can get an accurate
+ // hashrate?
+ for _, agent := range self.worker.agents {
+ tot += agent.GetHashRate()
+ }
+ return
}
func (self *Miner) SetExtra(extra []byte) {