aboutsummaryrefslogtreecommitdiffstats
path: root/lib/lightning.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lightning.js')
-rw-r--r--lib/lightning.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/lightning.js b/lib/lightning.js
index 2a8e8053..be5929b7 100644
--- a/lib/lightning.js
+++ b/lib/lightning.js
@@ -8,8 +8,8 @@ import { g, s, db } from "$lib/db";
export async function listenForLightning() {
let {
- payment_hash,
- bolt11: request,
+ payment_hash: hash,
+ bolt11,
pay_index,
status,
msatoshi_received,
@@ -25,10 +25,10 @@ export async function listenForLightning() {
if (!preimage) return;
- let invoice = await g(`invoice:${payment_hash}`);
- if (!invoice) return warn("received lightning with no invoice", request);
+ let invoice = await g(`invoice:${hash}`);
+ if (!invoice) return warn("received lightning with no invoice", bolt11);
- let { hash, currency, memo, rate, tip, uid } = invoice;
+ let { currency, memo, rate, tip, uid } = invoice;
let amount = parseInt(received) - tip;
if (amount < 0) throw new Error("amount out of range");
@@ -50,7 +50,7 @@ export async function listenForLightning() {
invoice.status = "paid";
invoice.received += received;
- await s(`invoice:${payment_hash}`, invoice);
+ await s(`invoice:${hash}`, invoice);
let t = async () => {
await db.watch(`balance:${uid}`);