From b8cfc175d924a467b7c3d43e2e9b24b6b3703007 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 12 Feb 2025 13:40:23 -0800 Subject: catch nwc errors --- lib/nwc.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/nwc.ts b/lib/nwc.ts index f5b8b11b..53cda3b4 100644 --- a/lib/nwc.ts +++ b/lib/nwc.ts @@ -330,15 +330,15 @@ const handle = (method, params, ev, app, user) => if (p.amount < 0 && type === "incoming") continue; if (p.amount > 0 && type === "outgoing") continue; - let payment_hash; - try { - ({ payment_hash } = - p.type === "lightning" - ? p.amount > 0 + let payment_hash = p.id; + if (p.type === "lightning") { + try { + ({ payment_hash } = + p.amount > 0 ? await ln.listinvoices({ invstring: p.hash }) - : await ln.listpays({ bolt11: p.hash }) - : p.id); - } catch (e) {} + : await ln.listpays({ bolt11: p.hash })); + } catch (e) {} + } const created_at = Math.floor(p.created / 1000); -- cgit v1.2.3