diff options
| author | Adam Soltys <[email protected]> | 2023-01-17 12:30:30 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-01-17 12:30:30 -0800 |
| commit | 5ae4209579287c571559edcf00dce24754553aaf (patch) | |
| tree | f897e334e3781345af66b11cd7a2b3b712912354 /lib/lightning.js | |
| parent | e918a818acf789a6619cbf4432f0c4713d4c53e6 (diff) | |
| download | coinos-server-5ae4209579287c571559edcf00dce24754553aaf.tar.gz coinos-server-5ae4209579287c571559edcf00dce24754553aaf.zip | |
rename db
Diffstat (limited to 'lib/lightning.js')
| -rw-r--r-- | lib/lightning.js | 12 |
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}`); |
