aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-03-07 22:23:54 +0000
committerAdam Soltys <[email protected]>2025-03-07 22:23:56 +0000
commitb44b1096a58d07a5101126dcf0756493d940b12c (patch)
treeba483b5c169ecd0b20e9d428c8cbab25d90e33c1
parenta7667374c8a60b96646650c94a858d55cfb53124 (diff)
downloadcoinos-server-b44b1096a58d07a5101126dcf0756493d940b12c.tar.gz
coinos-server-b44b1096a58d07a5101126dcf0756493d940b12c.zip
fix invoice lookup
-rw-r--r--lib/lightning.ts10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/lightning.ts b/lib/lightning.ts
index 326b5721..8f5f44bc 100644
--- a/lib/lightning.ts
+++ b/lib/lightning.ts
@@ -27,10 +27,7 @@ export async function listenForLightning() {
try {
if (!preimage) return;
- const id = bolt11
- ? await getInvoice(bolt11)
- : await getInvoice(local_offer_id);
- const invoice = await getInvoice(id);
+ const invoice = await getInvoice(bolt11 ?? local_offer_id);
if (!invoice) return warn("received lightning with no invoice", bolt11);
const p = await getPayment(bolt11 || bolt12);
@@ -78,10 +75,7 @@ export async function replay(index) {
try {
if (!preimage) return;
- const id = bolt11
- ? await getInvoice(bolt11)
- : await getInvoice(local_offer_id);
- const invoice = await getInvoice(id);
+ const invoice = await getInvoice(bolt11 ?? local_offer_id);
if (!invoice) return warn("received lightning with no invoice", bolt11);
const p = await getPayment(bolt11 || bolt12);