Fixes eth.hashrate panic #393 (#409)

This commit is contained in:
Samer Falah 2018-06-13 16:48:16 -04:00 committed by fixanoid
parent 31598781f4
commit f3d1315269
1 changed files with 3 additions and 0 deletions

View File

@ -583,6 +583,9 @@ func (ethash *Ethash) SetThreads(threads int) {
// Hashrate implements PoW, returning the measured rate of the search invocations
// per second over the last minute.
func (ethash *Ethash) Hashrate() float64 {
if(ethash.hashrate == nil){
return 0
}
return ethash.hashrate.Rate1()
}