Skip to content

Ethash.Hashrate

Source (upstream pre-purge) Current
File consensus/ethash/ethash.go ethash.go
Symbol Ethash.Hashrate Ethash.Hashrate
Ref dde2da0ef~1 etc/v1.17.3-full-node

ADAPT: .Rate1().Snapshot().Rate1() (#28035)

3-way merge — purge → getc ← upstream

pre-purgecore-geth
// Hashrate implements PoW, returning the measured rate of the search invocations
// per second over the last minute.
// Note the returned hashrate includes local hashrate, but also includes the total
// hashrate of all remote miner.
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 {
ms := ethash.hashrate.Snapshot()
return ms.Rate1()
}
var res = make(chan uint64, 1)
select {
case ethash.remote.fetchRateCh <- res:
case <-ethash.remote.exitCh:
// Return local hashrate only if ethash is stopped.
ms := ethash.hashrate.Snapshot()
return ms.Rate1()
}
// Gather total submitted hash rate of remote sealers.
ms := ethash.hashrate.Snapshot()
return ms.Rate1() + float64(<-res)
core-geth validation — **Identical** ✅ | | | |---|---| | File | [`ethash.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/consensus/ethash/ethash.go) | | Symbol | `Ethash.Hashrate` | | Ref | `v1.12.20` |

← Consensus & Ethash