diff options
| author | Adam Soltys <[email protected]> | 2025-12-04 08:46:38 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-04 08:46:38 -0800 |
| commit | 1a85079296356272d04f9bb7273243921062ee92 (patch) | |
| tree | 594f2c495391c676f6286e9fb372e39ff69f2cc5 /lib | |
| parent | 70e727eca29a7b99d48ea9a2acd3bf39a5352cb7 (diff) | |
| parent | 3e7634fc3460d8261f9cc9c359182914b83a6a34 (diff) | |
| download | coinos-server-1a85079296356272d04f9bb7273243921062ee92.tar.gz coinos-server-1a85079296356272d04f9bb7273243921062ee92.zip | |
Merge pull request #82 from ericpp/catch-failed-keysend
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 bbdbe2f5..e9a1ddef 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 ({ |
