diff options
| author | Adam Soltys <[email protected]> | 2020-03-28 23:13:13 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-03-28 23:13:13 -0700 |
| commit | a0422300e2b13896634eda12930959bc64ba7dc9 (patch) | |
| tree | 481915dc9e311d7dfc31d0b237b2c06ad5fa26a5 /routes/lightning/invoice.js | |
| parent | 5142c8cfcffd59d04ec18e67183a1866324d9209 (diff) | |
| download | coinos-server-a0422300e2b13896634eda12930959bc64ba7dc9.tar.gz coinos-server-a0422300e2b13896634eda12930959bc64ba7dc9.zip | |
handle tips and invoices better
Diffstat (limited to 'routes/lightning/invoice.js')
| -rw-r--r-- | routes/lightning/invoice.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/routes/lightning/invoice.js b/routes/lightning/invoice.js index 50be961d..f19b3484 100644 --- a/routes/lightning/invoice.js +++ b/routes/lightning/invoice.js @@ -1,13 +1,13 @@ module.exports = async (req, res) => { - let err = m => res.status(500).send(m); - let { amount, tip } = req.body; + const { amount, tip } = req.body; + + l.info("adding lightning invoice", req.user.username, amount, tip); - let invoice; try { - invoice = await lnb.addInvoice({ value: amount + tip }); + const invoice = await lnb.addInvoice({ value: amount + tip }); + res.send(invoice.payment_request); } catch (e) { - return err(e.message); + l.error("problem creating invoice", e.message); + res.status(500).send(e.message); } - - res.send(invoice.payment_request); }; |
