aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-01-23 20:23:09 +0000
committerAdam Soltys <[email protected]>2025-01-23 20:23:10 +0000
commit7ae9d76d8e625ab321786ef524da386408268a1f (patch)
tree648fbe4c80a8efcce3b17a0f722a86210a1b95ba
parent05ab044fa555c9e9b0d8f947e600d9c2f524c34d (diff)
downloadcoinos-server-7ae9d76d8e625ab321786ef524da386408268a1f.tar.gz
coinos-server-7ae9d76d8e625ab321786ef524da386408268a1f.zip
check if bolt11
-rw-r--r--lib/lightning.ts6
1 files 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);