From 3e7634fc3460d8261f9cc9c359182914b83a6a34 Mon Sep 17 00:00:00 2001 From: Eric P Date: Sun, 9 Nov 2025 17:09:01 -0600 Subject: Catch failed keysend payments --- lib/payments.ts | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/payments.ts b/lib/payments.ts index 07048f99..bc1f5357 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -505,17 +505,18 @@ export const sendKeysend = async ({ type: PaymentType.lightning, }); - const r = await ln.keysend({ - destination: pubkey, - amount_msat: amount * 1000, - maxfee: fee * 1000, - retry_for: 10, - extratlvs, - }); - - if (r.status !== "complete") reverse(p); - - return r; + try { + return await ln.keysend({ + destination: pubkey, + amount_msat: amount * 1000, + maxfee: fee * 1000, + retry_for: 10, + extratlvs, + }); + } catch (e) { + reverse(p); + throw e; + } }; export const sendLightning = async ({ -- cgit v1.2.3