Ethash¶
| Source (upstream pre-purge) | Current | |
|---|---|---|
| File | consensus/ethash/ethash.go |
ethash.go |
| Symbol | Ethash |
Ethash |
| Ref | dde2da0ef~1 |
etc/v1.17.3-full-node |
ADAPT:
hashratefield:metrics.Meter→*metrics.Meter(#28035)
3-way merge — purge → getc ← upstream¶
pre-purgecommon≈ adapted (origin inferred by similarity)
// Ethash is a consensus engine based on proof-of-work implementing the ethash
// algorithm.
type Ethash struct {
↗ config Config
↗ caches *lru[*cache] // In memory caches to avoid regenerating too often
datasets *lru[*dataset] // In memory datasets to avoid regenerating too often
↗ // Mining related fields
≈ rand *rand.Rand // Properly seeded random source for nonces
threads int // Number of threads to mine on if mining
update chan struct{} // Notification channel to update mining parameters
hashrate *metrics.Meter // Meter tracking the average hashrate
↗ remote *remoteSealer
↗ // The fields below are hooks for testing
shared *Ethash // Shared PoW verifier to avoid cache regeneration
fakeFail uint64 // Block number which fails PoW check even in fake mode
fakeDelay time.Duration // Time delay to sleep for before returning from verify
↗ lock sync.Mutex // Ensures thread safety for the in-memory caches and mining fields
closeOnce sync.Once // Ensures exit channel will not be closed twice.
}
core-geth validation — +1 -1
| | | |---|---| | File | [`ethash.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/consensus/ethash/ethash.go) | | Symbol | `Ethash` | | Ref | `v1.12.20` |--- a/core-geth/consensus/ethash/ethash.go
+++ b/etc/consensus/ethash/ethash.go
@@ -10,7 +10,7 @@
rand *rand.Rand // Properly seeded random source for nonces
threads int // Number of threads to mine on if mining
update chan struct{} // Notification channel to update mining parameters
- hashrate metrics.Meter // Meter tracking the average hashrate
+ hashrate *metrics.Meter // Meter tracking the average hashrate
remote *remoteSealer
// The fields below are hooks for testing