Skip to content

New

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

NewMeterForced() call kept as in the original; the forced constructor is revived in metrics/meter_forced.go (see Metrics). core-geth adapted this call to NewMeter() instead (7239c0bc9), which without --metrics constructs a NilMeter — its local hashrate permanently reads 0.

3-way merge — purge → getc ← upstream

pre-purge
// New creates a full sized ethash PoW scheme and starts a background thread for
// remote mining, also optionally notifying a batch of remote services of new work
// packages.
func New(config Config, notify []string, noverify bool) *Ethash {
if config.Log == nil {
config.Log = log.Root()
}
if config.CachesInMem <= 0 {
config.Log.Warn("One ethash cache must always be in memory", "requested", config.CachesInMem)
config.CachesInMem = 1
}
if config.CacheDir != "" && config.CachesOnDisk > 0 {
config.Log.Info("Disk storage enabled for ethash caches", "dir", config.CacheDir, "count", config.CachesOnDisk)
}
if config.DatasetDir != "" && config.DatasetsOnDisk > 0 {
config.Log.Info("Disk storage enabled for ethash DAGs", "dir", config.DatasetDir, "count", config.DatasetsOnDisk)
}
ethash := &Ethash{
config: config,
caches: newlru(config.CachesInMem, newCache),
datasets: newlru(config.DatasetsInMem, newDataset),
update: make(chan struct{}),
hashrate: metrics.NewMeterForced(),
}
if config.PowMode == ModeShared {
ethash.shared = sharedEthash
}
ethash.remote = startRemoteSealer(ethash, notify, noverify)
return ethash
}
core-geth validation — +1 -1 | | | |---|---| | File | [`ethash.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/consensus/ethash/ethash.go) | | Symbol | `New` | | Ref | `v1.12.20` |
--- a/core-geth/consensus/ethash/ethash.go
+++ b/etc/consensus/ethash/ethash.go
@@ -20,7 +20,7 @@
        caches:   newlru(config.CachesInMem, newCache),
        datasets: newlru(config.DatasetsInMem, newDataset),
        update:   make(chan struct{}),
-       hashrate: metrics.NewMeter(),
+       hashrate: metrics.NewMeterForced(),
    }
    if config.PowMode == ModeShared {
        ethash.shared = sharedEthash

← Consensus & Ethash