mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
consensus/ethash: ensure future cache/dataset is in the lru cache
This commit is contained in:
parent
0326bb8824
commit
ca57aa1670
1 changed files with 4 additions and 3 deletions
|
|
@ -177,10 +177,11 @@ func (lru *lru) get(epoch uint64) (item, future interface{}) {
|
|||
item, ok := lru.cache.Get(epoch)
|
||||
if !ok {
|
||||
if lru.future > 0 && lru.future == epoch {
|
||||
return lru.futureItem, nil
|
||||
}
|
||||
item = lru.future
|
||||
} else {
|
||||
log.Trace("Requiring new ethash "+lru.what, "epoch", epoch)
|
||||
item = lru.new(epoch)
|
||||
}
|
||||
lru.cache.Add(epoch, item)
|
||||
}
|
||||
// Update the 'future item' if epoch is larger than previously seen.
|
||||
|
|
|
|||
Loading…
Reference in a new issue