diff options
| author | Adam Soltys <[email protected]> | 2020-05-18 17:53:08 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-05-18 17:53:08 -0700 |
| commit | b8e8ed1e0c1bc181eaab91d5f299a512a25a4cd2 (patch) | |
| tree | ae6b209fd2cba819d4b6a0d6956e2f2006559866 /routes/liquid | |
| parent | af2d18b6508a3b50ee8272850707b5bf8c0e50a2 (diff) | |
| download | coinos-server-b8e8ed1e0c1bc181eaab91d5f299a512a25a4cd2.tar.gz coinos-server-b8e8ed1e0c1bc181eaab91d5f299a512a25a4cd2.zip | |
handle no token
Diffstat (limited to 'routes/liquid')
| -rw-r--r-- | routes/liquid/receive.js | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/routes/liquid/receive.js b/routes/liquid/receive.js index 581d7ebc..47058c4d 100644 --- a/routes/liquid/receive.js +++ b/routes/liquid/receive.js @@ -175,23 +175,25 @@ zmqRawBlock.on("message", async (topic, message, sequence) => { payment.confirmed = true; await payment.save({ transaction }); - account = await db.Account.findOne({ - where: { user_id, asset: token }, - lock: transaction.LOCK.UPDATE, - transaction - }); - account.balance = token_amount * SATS; - account.pending = 0; - await account.save({ transaction }); + if (token) { + account = await db.Account.findOne({ + where: { user_id, asset: token }, + lock: transaction.LOCK.UPDATE, + transaction + }); + account.balance = token_amount * SATS; + account.pending = 0; + await account.save({ transaction }); - payment = await db.Payment.findOne({ - where: { id: token_payment_id }, - lock: transaction.LOCK.UPDATE, - transaction - }); + payment = await db.Payment.findOne({ + where: { id: token_payment_id }, + lock: transaction.LOCK.UPDATE, + transaction + }); - payment.confirmed = true; - await payment.save({ transaction }); + payment.confirmed = true; + await payment.save({ transaction }); + } const user = await getUserById(user_id, transaction); emit(user.username, "user", user); |
