From 39e162088a760d1fe43b66ccac61fbbcb1f38780 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Sat, 22 Jan 2022 15:44:05 +0100 Subject: [PATCH] Do not return invoices that are in the initialized state Initialized is an internal state before the invoice was created on LND. We should not expose those. If an invoice is in that state it means it is either currently created or something went wrong. --- lib/service/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/service/user.go b/lib/service/user.go index b38f01d..59880cd 100644 --- a/lib/service/user.go +++ b/lib/service/user.go @@ -74,7 +74,7 @@ func (svc *LndhubService) InvoicesFor(ctx context.Context, userId int64, invoice query := svc.DB.NewSelect().Model(&invoices).Where("user_id = ?", userId) if invoiceType != "" { - query.Where("type = ?", invoiceType) + query.Where("type = ? AND state <> ?", invoiceType, "initialized") } query.OrderExpr("id DESC").Limit(100) err := query.Scan(ctx)