aboutsummaryrefslogtreecommitdiffstats
path: root/routes/send.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2021-12-20 17:02:36 -0800
committerAdam Soltys <[email protected]>2021-12-20 17:02:36 -0800
commit1330871bb24af45376847b2290c0900870fb98a8 (patch)
tree76b0745ff4a417dfac8d09b00d8d8f7d7f918367 /routes/send.js
parentc84f87e209c152754ab7b4b274b3092ac119b9db (diff)
downloadcoinos-server-1330871bb24af45376847b2290c0900870fb98a8.tar.gz
coinos-server-1330871bb24af45376847b2290c0900870fb98a8.zip
update assets fallback
Diffstat (limited to 'routes/send.js')
-rw-r--r--routes/send.js15
1 files changed, 6 insertions, 9 deletions
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);
}
});