From 9ec50cddc441b591d9e48e9f06fed545acb3cdfb Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Fri, 22 Dec 2023 22:51:13 +0700 Subject: [PATCH] fix: return LND invoices and payments in reversed order --- lnd.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lnd.go b/lnd.go index 9de5e334..e513623e 100644 --- a/lnd.go +++ b/lnd.go @@ -63,7 +63,7 @@ func (svc *LNDService) ListTransactions(ctx context.Context, senderPubkey string // Fetch invoices var invoices []*lnrpc.Invoice if invoiceType == "" || invoiceType == "incoming" { - incomingResp, err := svc.client.ListInvoices(ctx, &lnrpc.ListInvoiceRequest{NumMaxInvoices: limit, IndexOffset: offset}) + incomingResp, err := svc.client.ListInvoices(ctx, &lnrpc.ListInvoiceRequest{Reversed: true, NumMaxInvoices: limit, IndexOffset: offset}) if err != nil { return nil, err } @@ -82,7 +82,7 @@ func (svc *LNDService) ListTransactions(ctx context.Context, senderPubkey string var payments []*lnrpc.Payment if invoiceType == "" || invoiceType == "outgoing" { // Not just pending but failed payments will also be included because of IncludeIncomplete - outgoingResp, err := svc.client.ListPayments(ctx, &lnrpc.ListPaymentsRequest{MaxPayments: limit, IndexOffset: offset, IncludeIncomplete: unpaid}) + outgoingResp, err := svc.client.ListPayments(ctx, &lnrpc.ListPaymentsRequest{Reversed: true, MaxPayments: limit, IndexOffset: offset, IncludeIncomplete: unpaid}) if err != nil { return nil, err }