From 27f297af98d43c0f679e24dc975b5eca0a6a6f59 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 {