Ethash.cache¶
| Source (upstream pre-purge) | Current | |
|---|---|---|
| File | consensus/ethash/ethash.go |
ethash.go |
| Symbol | Ethash.cache |
Ethash.cache |
| Ref | dde2da0ef~1 |
etc/v1.17.3-full-node |
3-way merge — purge → getc ← upstream¶
pre-purgecore-geth
↗// cache tries to retrieve a verification cache for the specified block number
// by first checking against a list of in-memory caches, then against caches
// stored on disk, and finally generating one if none can be found.
func (ethash *Ethash) cache(block uint64) *cache {
↗ epochLength := calcEpochLength(block, ethash.config.ECIP1099Block)
epoch := calcEpoch(block, epochLength)
current, future := ethash.caches.get(epoch, epochLength, ethash.config.ECIP1099Block)
↗ // Wait for generation finish.
current.generate(ethash.config.CacheDir, ethash.config.CachesOnDisk, ethash.config.CachesLockMmap, ethash.config.PowMode == ModeTest)
↗ // If we need a new future cache, now's a good time to regenerate it.
if future != nil {
go future.generate(ethash.config.CacheDir, ethash.config.CachesOnDisk, ethash.config.CachesLockMmap, ethash.config.PowMode == ModeTest)
}
return current
}