aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/nwc.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/nwc.ts b/lib/nwc.ts
index c9419043..3b04eecf 100644
--- a/lib/nwc.ts
+++ b/lib/nwc.ts
@@ -367,10 +367,13 @@ const handle = (method, params, ev, app, user) =>
let payment_hash = p.payment_hash || pid;
if (p.type === "lightning") {
try {
- ({ payment_hash } =
- p.amount > 0
- ? await ln.listinvoices({ invstring: p.hash })
- : await ln.listpays({ bolt11: p.hash }));
+ if(p.amount > 0) {
+ const { invoices } = await ln.listinvoices({ invstring: p.hash });
+ payment_hash ||= invoices[0].payment_hash;
+ } else {
+ const { pays } = await ln.listpays({ bolt11: p.hash });
+ payment_hash ||= pays[0].payment_hash;
+ }
} catch (e) {}
}