From ca57aa1670be6d89bc5fb942e9514faf58467a02 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 15 Jan 2018 13:58:35 +0100 Subject: [PATCH] consensus/ethash: ensure future cache/dataset is in the lru cache --- consensus/ethash/ethash.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/consensus/ethash/ethash.go b/consensus/ethash/ethash.go index 631dacc306..a1a4da4980 100644 --- a/consensus/ethash/ethash.go +++ b/consensus/ethash/ethash.go @@ -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) } - 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.