From 7ae9d76d8e625ab321786ef524da386408268a1f Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 23 Jan 2025 20:23:09 +0000 Subject: check if bolt11 --- lib/lightning.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/lightning.ts b/lib/lightning.ts index 3888a405..f63b57be 100644 --- a/lib/lightning.ts +++ b/lib/lightning.ts @@ -25,8 +25,7 @@ export async function listenForLightning() { try { if (!preimage) return; - const id = - (await g(`invoice:${bolt11}`)) || (await g(`invoice:${local_offer_id}`)); + const id = bolt11 ? (await g(`invoice:${bolt11}`)) : (await g(`invoice:${local_offer_id}`)); const invoice = await g(`invoice:${id}`); if (!invoice) return warn("received lightning with no invoice", bolt11); @@ -74,8 +73,7 @@ export async function replay(index) { try { if (!preimage) return; - const id = - (await g(`invoice:${bolt11}`)) || (await g(`invoice:${local_offer_id}`)); + const id = bolt11 ? (await g(`invoice:${bolt11}`)) : (await g(`invoice:${local_offer_id}`)); const invoice = await g(`invoice:${id}`); if (!invoice) return warn("received lightning with no invoice", bolt11); -- cgit v1.2.3