diff options
| author | Adam Soltys <[email protected]> | 2021-12-20 17:02:36 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-12-20 17:02:36 -0800 |
| commit | 1330871bb24af45376847b2290c0900870fb98a8 (patch) | |
| tree | 76b0745ff4a417dfac8d09b00d8d8f7d7f918367 /routes | |
| parent | c84f87e209c152754ab7b4b274b3092ac119b9db (diff) | |
| download | coinos-server-1330871bb24af45376847b2290c0900870fb98a8.tar.gz coinos-server-1330871bb24af45376847b2290c0900870fb98a8.zip | |
update assets fallback
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/assets.js | 3 | ||||
| -rw-r--r-- | routes/send.js | 15 |
2 files changed, 7 insertions, 11 deletions
diff --git a/routes/assets.js b/routes/assets.js index 62c018e4..ccff012d 100644 --- a/routes/assets.js +++ b/routes/assets.js @@ -8,8 +8,7 @@ let fetchAssets; const { data: assets } = await axios.get( "https://assets.blockstream.info/" ); - var liquid_assets = require("./../assets.json"); - app.set("assets", liquid_assets); + app.set("assets", assets); } catch (e) { var liquid_assets = require("./../assets.json"); if (liquid_assets) { diff --git a/routes/send.js b/routes/send.js index e161ce65..f5087f37 100644 --- a/routes/send.js +++ b/routes/send.js @@ -22,16 +22,17 @@ module.exports = ah(async (req, res, next) => { try { await db.transaction(async transaction => { let account; - if (user.account.asset === asset) + if (user.account.asset === asset) { account = await db.Account.findOne({ where: { id: user.account.id, - pubkey:null, + pubkey: null }, lock: transaction.LOCK.UPDATE, transaction }); - else + } + else { account = await db.Account.findOne({ where: { user_id: user.id, @@ -41,6 +42,7 @@ module.exports = ah(async (req, res, next) => { lock: transaction.LOCK.UPDATE, transaction }); + } if (account.balance < amount) { throw new Error("Insufficient funds"); @@ -206,12 +208,7 @@ module.exports = ah(async (req, res, next) => { res.send(payment); }); } catch (e) { - l.error( - "problem sending internal payment", - user.username, - account.balance, - e.message - ); + l.error("problem sending internal payment", user.username, e.message); return res.status(500).send(e.message); } }); |
