aboutsummaryrefslogtreecommitdiffstats
path: root/lib/lightning.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-09-03 20:49:34 -0700
committerAdam Soltys <[email protected]>2023-09-03 20:49:34 -0700
commitc8043f25ff3c9fc6e17724061c0fec456b9f3c2c (patch)
tree71d27f182563394eef30d84a553676baf30db276 /lib/lightning.js
parentdd93caa76eee95ace50f05ca13a344bc3bc5ad4a (diff)
parent3aa200db295438827bfff48f80e3f4b25f44e8ea (diff)
downloadcoinos-server-c8043f25ff3c9fc6e17724061c0fec456b9f3c2c.tar.gz
coinos-server-c8043f25ff3c9fc6e17724061c0fec456b9f3c2c.zip
Merge branch 'prod'
Diffstat (limited to 'lib/lightning.js')
-rw-r--r--lib/lightning.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/lightning.js b/lib/lightning.js
index 1ccdbaa4..0c5fd75e 100644
--- a/lib/lightning.js
+++ b/lib/lightning.js
@@ -10,7 +10,6 @@ import { credit, types } from "$lib/payments";
export async function listenForLightning() {
let event = await ln.waitanyinvoice(await g("pay_index"));
let {
- payment_hash: hash,
bolt11,
pay_index,
status,
@@ -28,13 +27,13 @@ export async function listenForLightning() {
if (!preimage) return;
- let invoice = await g(`invoice:${hash}`);
+ let invoice = await g(`invoice:${bolt11}`);
if (!invoice) return warn("received lightning with no invoice", bolt11);
- let payment = await g(`payment:${hash}`);
- if (payment) return warn("already processed", hash);
+ let payment = await g(`payment:${bolt11}`);
+ if (payment) return warn("already processed", bolt11);
- await credit(hash, received, invoice.memo, preimage, types.lightning);
+ await credit(bolt11, received, invoice.memo, preimage, types.lightning);
} catch (e) {
console.log(e);
err("problem receiving lightning payment", e.message);