Skip to content

Miner.Hashrate

Source (upstream pre-purge) Current
File miner/miner.go miner_pow.go
Symbol Miner.Hashrate Miner.Hashrate
Ref dde2da0ef~1 etc/v1.17.3-full-node

3-way merge — purge → getc ← upstream

pre-purge≈ adapted (origin inferred by similarity)fork-only
// Hashrate returns the current mining hashrate. The internal interface
// matches ethash.Hashrate (float64); the value is truncated to uint64 for
// the JSON-RPC boundary in eth/api_pow.go.
func (m *Miner) Hashrate() uint64 {
type hashRater interface {
Hashrate() float64
}
if hr, ok := m.engine.(hashRater); ok {
return uint64(hr.Hashrate())
}
return 0
}
core-geth validation — +9 -3 | | | |---|---| | File | [`miner.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/miner/miner.go) | | Symbol | `Miner.Hashrate` | | Ref | `v1.12.20` |
--- a/core-geth/miner/miner.go
+++ b/etc/miner/miner_pow.go
@@ -1,6 +1,12 @@
-func (miner *Miner) Hashrate() uint64 {
-   if pow, ok := miner.engine.(consensus.PoW); ok {
-       return uint64(pow.Hashrate())
+// Hashrate returns the current mining hashrate. The internal interface
+// matches ethash.Hashrate (float64); the value is truncated to uint64 for
+// the JSON-RPC boundary in eth/api_pow.go.
+func (m *Miner) Hashrate() uint64 {
+   type hashRater interface {
+       Hashrate() float64
+   }
+   if hr, ok := m.engine.(hashRater); ok {
+       return uint64(hr.Hashrate())
    }
    return 0
 }

← Miner