diff options
| author | Adam Soltys <[email protected]> | 2022-10-18 21:00:50 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-10-18 21:58:51 -0700 |
| commit | 14b363bcfcfdd03f2232c2d0779ee90fc5cc27e6 (patch) | |
| tree | f928e100d091b26b1ec03808fa07933a50a8f178 /routes/liquid | |
| parent | 22d2777bb6bf9e5eb61fd14c05d8ae9ae7586481 (diff) | |
| download | coinos-server-14b363bcfcfdd03f2232c2d0779ee90fc5cc27e6.tar.gz coinos-server-14b363bcfcfdd03f2232c2d0779ee90fc5cc27e6.zip | |
improve asset issuance to internal user
Diffstat (limited to 'routes/liquid')
| -rw-r--r-- | routes/liquid/receive.js | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/routes/liquid/receive.js b/routes/liquid/receive.js index 2f90af5e..718feba5 100644 --- a/routes/liquid/receive.js +++ b/routes/liquid/receive.js @@ -58,10 +58,8 @@ const getAccount = async (params, transaction) => { params.seed = nc.seed; } - const assets = assets; - - if (assets[asset]) { - ({ domain, ticker, precision, name } = assets[asset]); + if (store.assets[asset]) { + ({ domain, ticker, precision, name } = store.assets[asset]); } else { const existing = await db.Account.findOne({ where: { @@ -149,13 +147,14 @@ zmqRawTx.on("message", async (topic, message, sequence) => { let account = await db.Account.findOne({ where: { - id: invoice.account_id + id: invoice.account_id, + asset }, lock: transaction.LOCK.UPDATE, transaction }); - if (!(account && account.asset === asset)) { + if (!account) { let pubkey = account ? account.pubkey : null; account = await getAccount( @@ -371,13 +370,7 @@ setInterval(async () => { emit(user.username, "account", account); emit(user.username, "payment", p); - l( - "liquid confirmed", - user.username, - account.asset, - p.amount, - p.tip - ); + l("liquid confirmed", user.username, account.asset, p.amount, p.tip); notify(user, `${total} SAT payment confirmed`); callWebhook(p.invoice, p); |
