From fd0163aa113258e02fde8bbf965293907b104e6c Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Mon, 18 Dec 2023 20:37:51 +0700 Subject: [PATCH] fix: only set preimage on transaction if Alby invoice is settled --- alby.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/alby.go b/alby.go index 9558a730..7a0e0f9d 100644 --- a/alby.go +++ b/alby.go @@ -704,13 +704,17 @@ func albyInvoiceToTransaction(invoice *AlbyInvoice) *Nip47Transaction { if description == "" { description = invoice.Memo } + var preimage string + if invoice.SettledAt != nil { + preimage = invoice.Preimage + } return &Nip47Transaction{ Type: invoice.Type, Invoice: invoice.PaymentRequest, Description: description, DescriptionHash: invoice.DescriptionHash, - Preimage: invoice.Preimage, + Preimage: preimage, PaymentHash: invoice.PaymentHash, Amount: invoice.Amount * 1000, FeesPaid: 0, // TODO: support fees