From 0a8a8988d27d26feec689a28447eed85c1069584 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 8 Jan 2025 22:42:20 +0000 Subject: prettier --- lib/lightning.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/lightning.ts b/lib/lightning.ts index e2c00483..19f6949d 100644 --- a/lib/lightning.ts +++ b/lib/lightning.ts @@ -30,6 +30,9 @@ export async function listenForLightning() { const invoice = await g(`invoice:${id}`); if (!invoice) return warn("received lightning with no invoice", bolt11); + const p = await getPayment(bolt11 || bolt12); + if (p) return warn("already processed", bolt11 || bolt12); + if (invoice?.memo) { try { if (JSON.parse(description).kind === 9734) handleZap(inv); @@ -39,9 +42,6 @@ export async function listenForLightning() { } } - const p = await getPayment(bolt11 || bolt12); - if (p) return warn("already processed", bolt11 || bolt12); - await credit({ hash: bolt11 || bolt12, amount: received, @@ -76,6 +76,9 @@ export async function replay(index) { const invoice = await g(`invoice:${id}`); if (!invoice) return warn("received lightning with no invoice", bolt11); + const p = await getPayment(bolt11 || bolt12); + if (p) return warn("already processed", bolt11 || bolt12); + if (invoice?.memo) { try { if (JSON.parse(description).kind === 9734) handleZap(inv); @@ -85,11 +88,6 @@ export async function replay(index) { } } - const p = await getPayment(bolt11 || bolt12); - if (p) { - return warn("already processed", bolt11 || bolt12); - } - await credit({ hash: bolt11 || bolt12, amount: received, -- cgit v1.2.3