Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug when init_slot less than 32 #126

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/analyzer/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions pkg/analyzer/routines.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down