diff options
| author | Adam Soltys <[email protected]> | 2020-07-17 20:55:47 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-07-17 20:55:59 -0700 |
| commit | 1962a6dcf1bb37bb8beb3fc4c0231d5a504a75fe (patch) | |
| tree | 46ffa53e3f7ebbdb2ea9c9abd1cf64405e1410cd /routes/lightning | |
| parent | 4a8abaa2722b629cebebb677249c3fd4f51292fb (diff) | |
| download | coinos-server-1962a6dcf1bb37bb8beb3fc4c0231d5a504a75fe.tar.gz coinos-server-1962a6dcf1bb37bb8beb3fc4c0231d5a504a75fe.zip | |
memos
Diffstat (limited to 'routes/lightning')
| -rw-r--r-- | routes/lightning/invoice.js | 7 | ||||
| -rw-r--r-- | routes/lightning/receive.js | 3 | ||||
| -rw-r--r-- | routes/lightning/send.js | 5 |
3 files changed, 8 insertions, 7 deletions
diff --git a/routes/lightning/invoice.js b/routes/lightning/invoice.js index 3b453a73..682fe542 100644 --- a/routes/lightning/invoice.js +++ b/routes/lightning/invoice.js @@ -1,14 +1,15 @@ module.exports = async (req, res) => { - const { amount, tip } = req.body; + const { amount, memo, tip } = req.body; l.info("adding lightning invoice", req.user.username, amount, tip); try { if (config.lna.clightning) { - const invoice = await lnb.invoice(`${amount + tip}sat` || "any", new Date(), "", 360); + const invoice = await lnb.invoice(`${amount + tip}sat` || "any", new Date(), memo, 360); res.send(invoice.bolt11); } else { - const invoice = await lnb.addInvoice({ value: amount + tip }); + const invoice = await lnb.addInvoice({ value: amount + tip, memo }); + l.info("invoice", invoice); res.send(invoice.payment_request); } } catch (e) { diff --git a/routes/lightning/receive.js b/routes/lightning/receive.js index 292f19e2..34ac1fc3 100644 --- a/routes/lightning/receive.js +++ b/routes/lightning/receive.js @@ -13,7 +13,7 @@ const handlePayment = async msg => { if (!invoice) return l.warn("received lightning with no invoice", msg.payment_request); - const { text: hash, currency, rate, tip, user_id } = invoice; + const { text: hash, currency, memo, rate, tip, user_id } = invoice; const amount = parseInt(msg.amt_paid_sat) - tip; const account = await db.Account.findOne({ @@ -37,6 +37,7 @@ const handlePayment = async msg => { account_id: account.id, user_id, hash, + memo, amount, currency, preimage, diff --git a/routes/lightning/send.js b/routes/lightning/send.js index 9aa4ddaf..be68143e 100644 --- a/routes/lightning/send.js +++ b/routes/lightning/send.js @@ -1,10 +1,9 @@ module.exports = async (req, res) => { - let { payreq } = req.body; - let { amount, route } = req.body; + let { amount, route, memo, payreq } = req.body; let { user } = req; try { - res.send(await send(amount, payreq, user)); + res.send(await send(amount, memo, payreq, user)); } catch (e) { l.error("problem sending lightning payment", user.username, e.message); res.status(500).send(e.message); |
