diff options
| author | Adam Soltys <[email protected]> | 2024-10-01 15:50:46 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-10-01 15:50:46 -0700 |
| commit | 80470a2c66c17e4992f176438025b2b021581d11 (patch) | |
| tree | 0f541e280fcaa86f52bc6578af4ce62901ba2518 /lib/lightning.ts | |
| parent | 426127506daa5f5e4c7ec851361bb54d4f769400 (diff) | |
| download | coinos-server-80470a2c66c17e4992f176438025b2b021581d11.tar.gz coinos-server-80470a2c66c17e4992f176438025b2b021581d11.zip | |
getpayment helper
Diffstat (limited to 'lib/lightning.ts')
| -rw-r--r-- | lib/lightning.ts | 5 |
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}); |
