Skip to content

Commit

Permalink
fix: only set preimage on transaction if Alby invoice is settled
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Dec 18, 2023
1 parent 32e9d10 commit fd0163a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion alby.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fd0163a

Please sign in to comment.