aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-07-18 18:01:26 +0800
committerMaran <maran.hidskes@gmail.com>2014-07-18 18:01:26 +0800
commit2b9f16802d22b8d743797aecc9bd040a38d6f1f4 (patch)
tree0c87f826a0e25970c79c7f6d9c45de1ee1c966e6
parent44296c0b33de5f6c2ff28c6a0fd528d6ccd04dec (diff)
downloadgo-tangerine-2b9f16802d22b8d743797aecc9bd040a38d6f1f4.tar.gz
go-tangerine-2b9f16802d22b8d743797aecc9bd040a38d6f1f4.tar.zst
go-tangerine-2b9f16802d22b8d743797aecc9bd040a38d6f1f4.zip
WIP to expose hashrate to gui
-rw-r--r--ethereal/gui.go8
-rw-r--r--utils/cmd.go4
2 files changed, 12 insertions, 0 deletions
diff --git a/ethereal/gui.go b/ethereal/gui.go
index 9a65ff3d0..8047db63e 100644
--- a/ethereal/gui.go
+++ b/ethereal/gui.go
@@ -7,6 +7,7 @@ import (
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethdb"
"github.com/ethereum/eth-go/ethlog"
+ "github.com/ethereum/eth-go/ethminer"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
@@ -40,6 +41,8 @@ type Gui struct {
Session string
clientIdentity *ethwire.SimpleClientIdentity
config *ethutil.ConfigManager
+
+ miner *ethminer.Miner
}
// Create GUI, but doesn't start it
@@ -124,6 +127,7 @@ func (gui *Gui) ToggleMining() {
txt = "Start mining"
} else {
utils.StartMining(gui.eth)
+ gui.miner = utils.GetMiner()
txt = "Stop mining"
}
@@ -346,6 +350,10 @@ func (gui *Gui) update() {
case <-peerChan:
gui.setPeerInfo()
case <-ticker.C:
+ if gui.miner != nil {
+ pow := gui.miner.GetPow()
+ fmt.Println("HashRate from miner", pow.GetHashrate())
+ }
gui.setPeerInfo()
}
}
diff --git a/utils/cmd.go b/utils/cmd.go
index 1e1599582..638114bbe 100644
--- a/utils/cmd.go
+++ b/utils/cmd.go
@@ -236,6 +236,10 @@ func StartRpc(ethereum *eth.Ethereum, RpcPort int) {
var miner ethminer.Miner
+func GetMiner() *ethminer.Miner {
+ return &miner
+}
+
func StartMining(ethereum *eth.Ethereum) bool {
if !ethereum.Mining {
ethereum.Mining = true