diff options
| author | Adam Soltys <[email protected]> | 2021-01-12 18:59:15 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-01-12 18:59:15 -0800 |
| commit | 8afa3af7f790bd1d78b2105e7541eed462fbb825 (patch) | |
| tree | 919a4877d49a1b810e5912ba1da34c19a0706cc1 | |
| parent | db09ca0ec48a88bed6257212bb298d688b9e2f25 (diff) | |
| download | coinos-server-8afa3af7f790bd1d78b2105e7541eed462fbb825.tar.gz coinos-server-8afa3af7f790bd1d78b2105e7541eed462fbb825.zip | |
use increment/decrement for self-sends
| -rw-r--r-- | routes/send.js | 8 |
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; |
