diff --git a/consensus/ethash/ethash.go b/consensus/ethash/ethash.go index 462f109564..3a1318d916 100644 --- a/consensus/ethash/ethash.go +++ b/consensus/ethash/ethash.go @@ -490,7 +490,7 @@ func New(config Config, notify []string, noverify bool) *Ethash { caches: newlru(config.CachesInMem, newCache), datasets: newlru(config.DatasetsInMem, newDataset), update: make(chan struct{}), - hashrate: metrics.NewMeterForced(), + hashrate: metrics.NewMeter(), } if config.PowMode == ModeShared { ethash.shared = sharedEthash @@ -662,7 +662,7 @@ func (ethash *Ethash) SetThreads(threads int) { func (ethash *Ethash) Hashrate() float64 { // Short circuit if we are run the ethash in normal/test mode. if ethash.config.PowMode != ModeNormal && ethash.config.PowMode != ModeTest { - return ethash.hashrate.Rate1() + return ethash.hashrate.Snapshot().Rate1() } var res = make(chan uint64, 1) @@ -670,11 +670,11 @@ func (ethash *Ethash) Hashrate() float64 { case ethash.remote.fetchRateCh <- res: case <-ethash.remote.exitCh: // Return local hashrate only if ethash is stopped. - return ethash.hashrate.Rate1() + return ethash.hashrate.Snapshot().Rate1() } // Gather total submitted hash rate of remote sealers. - return ethash.hashrate.Rate1() + float64(<-res) + return ethash.hashrate.Snapshot().Rate1() + float64(<-res) } // APIs implements consensus.Engine, returning the user facing RPC APIs.