diff options
Diffstat (limited to 'routes/lightning')
| -rw-r--r-- | routes/lightning/invoice.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/routes/lightning/invoice.js b/routes/lightning/invoice.js index 140a3002..1f3a0528 100644 --- a/routes/lightning/invoice.js +++ b/routes/lightning/invoice.js @@ -1,13 +1,20 @@ module.exports = ah(async (req, res) => { let { amount, memo, tip } = req.body; if (!tip) tip = 0; + let value = amount + tip; try { if (config.lna.clightning) { - const invoice = await lna.invoice(`${amount + tip}sat` || "any", new Date(), memo, 360); + if (!memo) memo = "coinos"; + const invoice = await lna.invoice( + value ? `${value}sat` : "any", + new Date(), + memo, + 360 + ); res.send(invoice.bolt11); } else { - const invoice = await lna.addInvoice({ value: amount + tip, memo }); + const invoice = await lna.addInvoice({ value, memo }); res.send(invoice.payment_request); } } catch (e) { |
