Skip to content

Commit

Permalink
use calc epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
anjor committed Nov 10, 2024
1 parent 59aec83 commit 6b6a10b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions multiepoch-getSignaturesForAddress.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ func (ser *MultiEpoch) getGsfaReadersInEpochDescendingOrderForSlotRange(ctx cont
ser.mu.RLock()
defer ser.mu.RUnlock()

epochs := make([]*Epoch, 0, len(ser.epochs))
startEpoch := CalcEpochForSlot(startSlot)
endEpoch := CalcEpochForSlot(endSlot)
numEpochs := endEpoch - startEpoch + 1

epochs := make([]*Epoch, 0, numEpochs)
for _, epoch := range ser.epochs {

epochStartSlot, err := epoch.GetFirstAvailableBlock(ctx)
epochEndSlot, err := epoch.GetMostRecentAvailableBlock(ctx)
if epochStartSlot.Slot > int(startSlot) && epochEndSlot.Slot < int(endSlot) {
if epoch.Epoch() >= startEpoch && epoch.Epoch() <= endEpoch {
epochs = append(epochs, epoch)
}
}
Expand Down

0 comments on commit 6b6a10b

Please sign in to comment.