diff options
| author | Adam Soltys <[email protected]> | 2021-05-30 06:38:58 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-06-09 16:06:45 -0700 |
| commit | c5374c599a9d96507bff6ff6d5b9e1f355e89eff (patch) | |
| tree | def064241e92be3f2f589dc67d161d25264dce59 /routes/lightning | |
| parent | 441cc95d60d198cc54a36a758d5fc8c4fe363938 (diff) | |
| download | coinos-server-c5374c599a9d96507bff6ff6d5b9e1f355e89eff.tar.gz coinos-server-c5374c599a9d96507bff6ff6d5b9e1f355e89eff.zip | |
changes to dev environment
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) { |
