From 7874e3eb564daf5bd5a2fb024a4228a388715658 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 31 Aug 2022 09:46:26 -0700 Subject: [PATCH 1/2] etchash: fix cache future item This fix echoes the fix originally made here https://github.com/etclabscore/core-geth/pull/499 Date: 2022-08-31 09:46:26-07:00 Signed-off-by: meows --- etchash.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etchash.go b/etchash.go index d0cf022..0df6026 100644 --- a/etchash.go +++ b/etchash.go @@ -259,7 +259,7 @@ func (lru *lru) get(epoch uint64, epochLength uint64, ecip1099FBlock *uint64) (i } // Update the 'future item' if epoch is larger than previously seen. - if epoch < maxEpoch-1 && lru.future < nextEpoch { + if epoch < maxEpoch-1 && lru.future != nextEpoch { log.Trace("Requiring new future etchash "+lru.what, "epoch", nextEpoch) future = lru.new(nextEpoch, nextEpochLength) lru.future = nextEpoch @@ -533,7 +533,7 @@ func (l *Light) getCache(blockNum uint64) *cache { return c } -/// dataset wraps an etchash dataset with some metadata to allow easier concurrent use. +// / dataset wraps an etchash dataset with some metadata to allow easier concurrent use. type dataset struct { epoch uint64 // Epoch for which this cache is relevant epochLength uint64 // Epoch length (ECIP-1099) From 2e3dc8f7e2327c5b5dc266d8fd7d1bab8fd97134 Mon Sep 17 00:00:00 2001 From: meowsbits Date: Wed, 31 Aug 2022 15:51:23 -0700 Subject: [PATCH 2/2] fix comment syntax Co-authored-by: Chris Ziogas --- etchash.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etchash.go b/etchash.go index 0df6026..a991a11 100644 --- a/etchash.go +++ b/etchash.go @@ -533,7 +533,7 @@ func (l *Light) getCache(blockNum uint64) *cache { return c } -// / dataset wraps an etchash dataset with some metadata to allow easier concurrent use. +// dataset wraps an etchash dataset with some metadata to allow easier concurrent use. type dataset struct { epoch uint64 // Epoch for which this cache is relevant epochLength uint64 // Epoch length (ECIP-1099)