From 272e6b1b295f02a21959bcd0deeb41125fa83a67 Mon Sep 17 00:00:00 2001 From: Anjor Kanekar Date: Thu, 21 Nov 2024 09:14:08 +0000 Subject: [PATCH] use multi epoch (#192) --- multiepoch-getSignaturesForAddress.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/multiepoch-getSignaturesForAddress.go b/multiepoch-getSignaturesForAddress.go index b6ad8e49..d953ed9c 100644 --- a/multiepoch-getSignaturesForAddress.go +++ b/multiepoch-getSignaturesForAddress.go @@ -43,7 +43,7 @@ func (ser *MultiEpoch) getGsfaReadersInEpochDescendingOrder() ([]*gsfa.GsfaReade } // getGsfaReadersInEpochDescendingOrder returns a list of gsfa readers in epoch order (from most recent to oldest). -func (ser *MultiEpoch) getGsfaReadersInEpochDescendingOrderForSlotRange(ctx context.Context, startSlot, endSlot uint64) ([]*gsfa.GsfaReader, []uint64) { +func (ser *MultiEpoch) getGsfaReadersInEpochDescendingOrderForSlotRange(ctx context.Context, startSlot, endSlot uint64) (*gsfa.GsfaReaderMultiepoch, []uint64) { ser.mu.RLock() defer ser.mu.RUnlock() @@ -72,7 +72,15 @@ func (ser *MultiEpoch) getGsfaReadersInEpochDescendingOrderForSlotRange(ctx cont epochNums = append(epochNums, epoch.Epoch()) } } - return gsfaReaders, epochNums + + gsfaReaderMultiEpoch, err := gsfa.NewGsfaReaderMultiepoch(gsfaReaders) + if err != nil { + klog.Errorf("failed to construct gsfaReaderMultiEpoch: %w", err) + return nil, nil + } + + return gsfaReaderMultiEpoch, epochNums + } func countTransactions(v gsfa.EpochToTransactionObjects) int {