aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2021-01-12 18:59:15 -0800
committerAdam Soltys <[email protected]>2021-01-12 18:59:15 -0800
commit8afa3af7f790bd1d78b2105e7541eed462fbb825 (patch)
tree919a4877d49a1b810e5912ba1da34c19a0706cc1
parentdb09ca0ec48a88bed6257212bb298d688b9e2f25 (diff)
downloadcoinos-server-8afa3af7f790bd1d78b2105e7541eed462fbb825.tar.gz
coinos-server-8afa3af7f790bd1d78b2105e7541eed462fbb825.zip
use increment/decrement for self-sends
-rw-r--r--routes/send.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/routes/send.js b/routes/send.js
index 6cb73b55..790cfff2 100644
--- a/routes/send.js
+++ b/routes/send.js
@@ -21,8 +21,8 @@ module.exports = ah(async (req, res, next) => {
let fee = 0;
- account.balance -= amount;
- await account.save({ transaction });
+ await account.decrement({ balance: amount }, { transaction });
+ await account.reload({ transaction });
let params = {
amount: -amount,
@@ -79,8 +79,8 @@ module.exports = ah(async (req, res, next) => {
}
if (a2) {
- a2.balance += amount;
- await a2.save({ transaction });
+ await a2.increment({ balance: amount }, { transaction });
+ await a2.reload({ transaction });
} else {
let name = asset.substr(0, 6);
let domain;