good morning!!!!

Skip to content
Snippets Groups Projects
Commit 65cad14f authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

Report debug hash rate

parent fdf939a6
No related branches found
No related tags found
No related merge requests found
......@@ -52,10 +52,5 @@ func (self *Miner) Stop() {
}
func (self *Miner) HashRate() int64 {
var tot int64
for _, agent := range self.worker.agents {
tot += agent.Pow().GetHashrate()
}
return tot
return self.worker.HashRate()
}
......@@ -5,6 +5,7 @@ import (
"math/big"
"sort"
"sync"
"time"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
......@@ -111,6 +112,8 @@ func (self *worker) register(agent Agent) {
func (self *worker) update() {
events := self.mux.Subscribe(core.ChainEvent{}, core.NewMinedBlockEvent{})
timer := time.NewTicker(2 * time.Second)
out:
for {
select {
......@@ -129,6 +132,8 @@ out:
agent.Stop()
}
break out
case <-timer.C:
minerlogger.Debugln("Hash rate:", self.HashRate(), "Khash")
}
}
......@@ -244,3 +249,12 @@ func (self *worker) commitTransaction(tx *types.Transaction) error {
return nil
}
func (self *worker) HashRate() int64 {
var tot int64
for _, agent := range self.agents {
tot += agent.Pow().GetHashrate()
}
return tot
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment