From b44b1096a58d07a5101126dcf0756493d940b12c Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 7 Mar 2025 22:23:54 +0000 Subject: fix invoice lookup --- lib/lightning.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'lib') 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); -- cgit v1.2.3