diff --git a/pkg/analyzer/download.go b/pkg/analyzer/download.go index 167ef17e..0ff9380d 100644 --- a/pkg/analyzer/download.go +++ b/pkg/analyzer/download.go @@ -50,6 +50,9 @@ func (s *ChainAnalyzer) WaitForPrevState(slot phase0.Slot) { // check if state two epochs before is available // the idea is that blocks are too fast to download, wait for states as well + if slot < spec.SlotsPerEpoch*2 { + return + } prevStateEpoch := slot/spec.SlotsPerEpoch - 2 // epoch to check if state downloaded prevStateSlot := (prevStateEpoch+1)*spec.SlotsPerEpoch - 1 // slot at which the check state was downloaded diff --git a/pkg/analyzer/routines.go b/pkg/analyzer/routines.go index 5896416c..12fd6752 100644 --- a/pkg/analyzer/routines.go +++ b/pkg/analyzer/routines.go @@ -177,10 +177,11 @@ func (s *ChainAnalyzer) runHistorical(init phase0.Slot, end phase0.Slot) { if i >= finalizedSlot.Slot { // keep 2 epochs before finalized, needed to calculate epoch metrics s.AdvanceFinalized(finalizedSlot.Slot - spec.SlotsPerEpoch*5) // includes check and clean - } else { + } else if i > (5 * spec.SlotsPerEpoch) { // keep 5 epochs before current downloading slot, need 3 at least for epoch metrics // magic number, 2 extra if processer takes long - s.downloadCache.CleanUpTo(i - (5 * spec.SlotsPerEpoch)) // only clean, no check, keep + cleanUpToSlot := i - (5 * spec.SlotsPerEpoch) + s.downloadCache.CleanUpTo(cleanUpToSlot) // only clean, no check, keep } }