aboutsummaryrefslogtreecommitdiffstats
path: root/routes/liquid
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-05-18 17:53:08 -0700
committerAdam Soltys <[email protected]>2020-05-18 20:40:40 -0700
commit8f5185128aae032cfc5ece712e337fa37337bb1d (patch)
tree8896337eb355cbf1a831b3deba465a6a8a378132 /routes/liquid
parentf33881d4a314d6bbf4c58a962723e0ab8feba837 (diff)
downloadcoinos-server-8f5185128aae032cfc5ece712e337fa37337bb1d.tar.gz
coinos-server-8f5185128aae032cfc5ece712e337fa37337bb1d.zip
handle no token
Diffstat (limited to 'routes/liquid')
-rw-r--r--routes/liquid/receive.js32
1 files changed, 17 insertions, 15 deletions
diff --git a/routes/liquid/receive.js b/routes/liquid/receive.js
index 0ce77635..cbb80cde 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);