aboutsummaryrefslogtreecommitdiffstats
path: root/lib/lightning.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-10-01 15:50:46 -0700
committerAdam Soltys <[email protected]>2024-10-01 15:50:46 -0700
commit80470a2c66c17e4992f176438025b2b021581d11 (patch)
tree0f541e280fcaa86f52bc6578af4ce62901ba2518 /lib/lightning.ts
parent426127506daa5f5e4c7ec851361bb54d4f769400 (diff)
downloadcoinos-server-80470a2c66c17e4992f176438025b2b021581d11.tar.gz
coinos-server-80470a2c66c17e4992f176438025b2b021581d11.zip
getpayment helper
Diffstat (limited to 'lib/lightning.ts')
-rw-r--r--lib/lightning.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/lightning.ts b/lib/lightning.ts
index 74869a19..7a35c9f2 100644
--- a/lib/lightning.ts
+++ b/lib/lightning.ts
@@ -3,6 +3,7 @@ import ln from "$lib/ln";
import { err, warn } from "$lib/logging";
import { g, s } from "$lib/db";
import { credit, types } from "$lib/payments";
+import { getPayment } from "$lib/utils";
export async function listenForLightning() {
let inv = await ln.waitanyinvoice((await g("pay_index")) || 0);
@@ -35,9 +36,7 @@ export async function listenForLightning() {
}
}
- let p = await g(`payment:${bolt11}`);
- if (typeof p === "string") p = await g(`payment:${p}`);
-
+ let p = await getPayment(bolt11);
if (p) return warn("already processed", bolt11);
await credit({ hash:bolt11, amount:received, memo:invoice.memo, ref:preimage, type:types.lightning});