diff options
| author | Adam Soltys <[email protected]> | 2025-03-05 20:46:37 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-03-05 20:46:37 +0000 |
| commit | 118386e0691a0c80a0d8c19ab40bd3abf6859b84 (patch) | |
| tree | b67ed419680743a860a1bae16af1aab4fff2f759 /lib | |
| parent | b01b24f6a1007bc8a3b41d9aeb7060e7aedaac1c (diff) | |
| download | coinos-server-118386e0691a0c80a0d8c19ab40bd3abf6859b84.tar.gz coinos-server-118386e0691a0c80a0d8c19ab40bd3abf6859b84.zip | |
fix payment_hash lookup
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/nwc.ts | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -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) {} } |
