From 5d2b15eef79c9c198719be50caa0aa2b35461431 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 17 Aug 2020 01:17:11 -0400 Subject: create new liquid account properly --- routes/liquid/receive.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/routes/liquid/receive.js b/routes/liquid/receive.js index 325e6783..49c95712 100644 --- a/routes/liquid/receive.js +++ b/routes/liquid/receive.js @@ -17,7 +17,11 @@ const getAccount = async (params, pending) => { where: params }); - if (account) return account; + + if (account) { + l.info("found account", params, account.asset, account.id); + return account; + } let { asset } = params; let name = asset.substr(0, 6); @@ -33,12 +37,14 @@ const getAccount = async (params, pending) => { const existing = await db.Account.findOne({ where: { asset, + pubkey, }, order: [["id", "ASC"]], limit: 1, }); if (existing) { + l.info("existing", existing.id); ({ domain, ticker, precision, name } = existing); } } @@ -101,7 +107,7 @@ zmqRawTx.on("message", async (topic, message, sequence) => { account.pending += value; await account.save(); } else { - if (!account) account = await getAccount( + account = await getAccount( { user_id: user.id, asset, -- cgit v1.2.3