From 8afa3af7f790bd1d78b2105e7541eed462fbb825 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 12 Jan 2021 18:59:15 -0800 Subject: use increment/decrement for self-sends --- routes/send.js | 8 ++++---- 1 file 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; -- cgit v1.2.3