Skip to content

Commit 44ef6ba

Browse files
committed
Include description hash in phoenix backend.
1 parent 5f4b1c7 commit 44ef6ba

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

lib/makeinvoice/makeinvoice.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,17 +378,24 @@ func MakeInvoice(params LNParams) (bolt11 string, err error) {
378378
payload := url.Values{}
379379

380380
if params.Description != "" {
381-
payload.Set("description", params.Description)
381+
if params.UseDescriptionHash {
382+
payload.Set("descriptionHash", hexh)
383+
} else {
384+
payload.Set("description", params.Description)
385+
}
386+
382387
} else {
383388
payload.Set("description", "created by makeinvoice")
384389
}
385390

386391
payload.Add("amountSat", fmt.Sprintf("%d", params.Msatoshi/1000))
387392

388-
data := bytes.NewBufferString(payload.Encode())
389-
390393
client := &http.Client{}
391-
req, err := http.NewRequest("POST", "http://"+backend.Host+"/createinvoice", data)
394+
req, err := http.NewRequest(
395+
"POST",
396+
"http://"+backend.Host+"/createinvoice",
397+
strings.NewReader(payload.Encode()),
398+
)
392399

393400
if err != nil {
394401
return "", err

makeinvoice.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,11 @@ func makeInvoice(
7676
// make the lnurlpay description_hash
7777

7878
if zap != "" {
79+
mip.UseDescriptionHash = true
7980
mip.Description = zap
8081
} else if comment != "" {
81-
mip.UseDescriptionHash = true
8282
mip.Description = comment
8383
} else {
84-
mip.UseDescriptionHash = true
8584
mip.Description = makeMetadata(params)
8685
}
8786

waitforinvoice.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ func WaitForInvoicePaid(payvalues LNURLPayValuesCustom, params *UserParams) {
9999
}
100100

101101
Client.Transport = specialTransport
102-
var maxiterations = 100
103-
ticker := time.NewTicker(100 * time.Millisecond)
102+
var maxiterations = 34
103+
ticker := time.NewTicker(10 * time.Second)
104104
quit := make(chan struct{})
105105

106106
for {

0 commit comments

Comments
 (0)