aboutsummaryrefslogtreecommitdiffstats
path: root/routes/lightning/send.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-04-28 22:09:22 -0700
committerAdam Soltys <[email protected]>2020-04-28 22:33:02 -0700
commit63c18105e6c66b3b4698c398f356bef1b496816f (patch)
treee7ee85e7c3502ed81954448a76be028143990948 /routes/lightning/send.js
parent994dd93f6c45c590ae59a699cbf425d96518da1e (diff)
downloadcoinos-server-63c18105e6c66b3b4698c398f356bef1b496816f.tar.gz
coinos-server-63c18105e6c66b3b4698c398f356bef1b496816f.zip
include account in emitted payments objects
Diffstat (limited to 'routes/lightning/send.js')
-rw-r--r--routes/lightning/send.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/routes/lightning/send.js b/routes/lightning/send.js
index 02149aa8..6f21cc9b 100644
--- a/routes/lightning/send.js
+++ b/routes/lightning/send.js
@@ -67,7 +67,7 @@ module.exports = async (req, res) => {
account.balance -= total - payreq.satoshis;
await account.save()
- const payment = await db.Payment.create({
+ let payment = await db.Payment.create({
amount: -total,
account_id: account.id,
user_id: user.id,
@@ -78,11 +78,13 @@ module.exports = async (req, res) => {
network: "LNBTC"
});
+ payment = payment.get({ plain: true });
+ payment.account = account.get({ plain: true });
+
seen.push(m.payment_preimage);
l.info("sent lightning", user.username, -payment.amount, m);
user = await getUser(user.username);
- emit(user.username, "payment", payment);
emit(user.username, "user", user);
if (payreq.payeeNodeKey === config.lnb.id) {
@@ -99,7 +101,7 @@ module.exports = async (req, res) => {
seen.push(hash);
res.send(payment);
} catch (e) {
- l.info("error sending lightning", e);
+ l.info("error sending lightning", e.message);
return res.status(500).send(e);
}
};