Skip to content

Commit

Permalink
fix: return LND invoices and payments in reversed order
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Dec 22, 2023
1 parent d0d3078 commit 9ec50cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lnd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down

0 comments on commit 9ec50cd

Please sign in to comment.