diff options
| author | Eric P <[email protected]> | 2025-11-09 17:09:01 -0600 |
|---|---|---|
| committer | Eric P <[email protected]> | 2025-11-09 17:10:04 -0600 |
| commit | 3e7634fc3460d8261f9cc9c359182914b83a6a34 (patch) | |
| tree | cd423680195d2d37364be50334cb6088a71c8fef /lib | |
| parent | 16e031fcf1bc91c8692a6689c8e281efb2d3b381 (diff) | |
| download | coinos-server-3e7634fc3460d8261f9cc9c359182914b83a6a34.tar.gz coinos-server-3e7634fc3460d8261f9cc9c359182914b83a6a34.zip | |
Catch failed keysend payments
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/payments.ts | 23 |
1 files changed, 12 insertions, 11 deletions
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 ({ |
