diff options
| author | Adam Soltys <[email protected]> | 2023-02-07 21:06:52 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-02-07 21:06:52 -0800 |
| commit | 1424d48d77e3680dc4bd75c24b320436b999dced (patch) | |
| tree | ef71e46e034d2c4ab3bee80acbf601d6393c2fd1 /routes/payments.js | |
| parent | 5cb759a6b0545c749cef5f30b6f109320c1052b2 (diff) | |
| download | coinos-server-1424d48d77e3680dc4bd75c24b320436b999dced.tar.gz coinos-server-1424d48d77e3680dc4bd75c24b320436b999dced.zip | |
handle zero amount invoices better
Diffstat (limited to 'routes/payments.js')
| -rw-r--r-- | routes/payments.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/routes/payments.js b/routes/payments.js index 1043959c..ec557474 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -36,6 +36,9 @@ export default { }) .json(); } else if (payreq) { + let { msatoshi } = await ln.decode(payreq); + if (msatoshi) amount = Math.round(msatoshi * 1000); + p = await debit( hash, amount + maxfee, @@ -45,7 +48,7 @@ export default { types.lightning ); - let r = await ln.pay(payreq); + let r = await ln.pay(payreq, msatoshi ? undefined : `${amount}sats`); p.amount = -amount; p.hash = r.payment_hash; |
