1
1
mirror of https://github.com/bumi/lntip synced 2026-02-17 14:37:50 +00:00

Provide LNURL metadata hash as description_hash in the lightning pr

This commit is contained in:
2021-09-03 01:39:06 +02:00
parent 492ffb2d3f
commit 4fb8fa9a73
2 changed files with 7 additions and 8 deletions

View File

@@ -2,7 +2,6 @@ package main
import (
"crypto/sha256"
"encoding/hex"
"flag"
"fmt"
"log"
@@ -110,7 +109,7 @@ func main() {
return c.JSON(http.StatusBadRequest, "Bad request")
}
invoice, err := lnClient.AddInvoice(i.Value, i.Memo)
invoice, err := lnClient.AddInvoice(i.Value, i.Memo, nil)
if err != nil {
stdOutLogger.Printf("Error creating invoice: %s", err)
return c.JSON(http.StatusInternalServerError, "Error adding invoice")
@@ -167,8 +166,7 @@ func main() {
}
sats := msats / 1000 // we need sats
metadataHash := sha256.Sum256([]byte(lnurlMetadata))
memo := hex.EncodeToString(metadataHash[:])
invoice, err := lnClient.AddInvoice(sats, memo)
invoice, err := lnClient.AddInvoice(sats, lightningAddress, metadataHash[:])
lnurlPayResponse2 := lnurl.LNURLPayResponse2{
LNURLResponse: lnurl.LNURLResponse{Status: "OK"},
PR: invoice.PaymentRequest,