diff options
| author | Adam Soltys <[email protected]> | 2020-06-08 13:04:02 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-06-08 13:04:02 -0700 |
| commit | 7a3a07bc711ea57fd8a84e809e7ecd0d6e64b5c2 (patch) | |
| tree | b31a06affa4b932990744997c271f6d65502d60c /routes/lightning/receive.js | |
| parent | 298672d3f50938ba06a16f8e04d607b7033703b8 (diff) | |
| download | coinos-server-7a3a07bc711ea57fd8a84e809e7ecd0d6e64b5c2.tar.gz coinos-server-7a3a07bc711ea57fd8a84e809e7ecd0d6e64b5c2.zip | |
reduce network traffic
Diffstat (limited to 'routes/lightning/receive.js')
| -rw-r--r-- | routes/lightning/receive.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/routes/lightning/receive.js b/routes/lightning/receive.js index 0e8d7e22..6a9c95c8 100644 --- a/routes/lightning/receive.js +++ b/routes/lightning/receive.js @@ -21,10 +21,16 @@ const handlePayment = async msg => { user_id, asset: config.liquid.btcasset }, + include: { + model: db.User, + as: 'user', + }, lock: transaction.LOCK.UPDATE, transaction }); + const { user } = account; + let preimage = msg.r_preimage.toString("hex"); let payment = await db.Payment.create({ @@ -50,12 +56,10 @@ const handlePayment = async msg => { await payment.save({ transaction }); payments.push(msg.payment_request); - let user = await getUserById(user_id, transaction); - payment = payment.get({ plain: true }); payment.account = account.get({ plain: true }); emit(user.username, "payment", payment); - emit(user.username, "user", user); + emit(user.username, "account", payment.account); l.info( "lightning payment received", |
