File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 7
7
"github.com/ethereum/eth-go/ethchain"
8
8
"github.com/ethereum/eth-go/ethdb"
9
9
"github.com/ethereum/eth-go/ethlog"
10
+ "github.com/ethereum/eth-go/ethminer"
10
11
"github.com/ethereum/eth-go/ethpub"
11
12
"github.com/ethereum/eth-go/ethutil"
12
13
"github.com/ethereum/eth-go/ethwire"
@@ -40,6 +41,8 @@ type Gui struct {
40
41
Session string
41
42
clientIdentity * ethwire.SimpleClientIdentity
42
43
config * ethutil.ConfigManager
44
+
45
+ miner * ethminer.Miner
43
46
}
44
47
45
48
// Create GUI, but doesn't start it
@@ -124,6 +127,7 @@ func (gui *Gui) ToggleMining() {
124
127
txt = "Start mining"
125
128
} else {
126
129
utils .StartMining (gui .eth )
130
+ gui .miner = utils .GetMiner ()
127
131
txt = "Stop mining"
128
132
}
129
133
@@ -346,6 +350,10 @@ func (gui *Gui) update() {
346
350
case <- peerChan :
347
351
gui .setPeerInfo ()
348
352
case <- ticker .C :
353
+ if gui .miner != nil {
354
+ pow := gui .miner .GetPow ()
355
+ fmt .Println ("HashRate from miner" , pow .GetHashrate ())
356
+ }
349
357
gui .setPeerInfo ()
350
358
}
351
359
}
Original file line number Diff line number Diff line change @@ -236,6 +236,10 @@ func StartRpc(ethereum *eth.Ethereum, RpcPort int) {
236
236
237
237
var miner ethminer.Miner
238
238
239
+ func GetMiner () * ethminer.Miner {
240
+ return & miner
241
+ }
242
+
239
243
func StartMining (ethereum * eth.Ethereum ) bool {
240
244
if ! ethereum .Mining {
241
245
ethereum .Mining = true
You can’t perform that action at this time.
0 commit comments