diff options
Diffstat (limited to 'sendCoins.js')
| -rw-r--r-- | sendCoins.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sendCoins.js b/sendCoins.js index 7eebdc8a..997af0dd 100644 --- a/sendCoins.js +++ b/sendCoins.js @@ -24,14 +24,13 @@ module.exports = (app, bc, db, emit) => async (req, res) => { try { await db.transaction(async transaction => { - let { balance } = await db.User.findOne( - { - where: { - username: req.user.username - } + let { balance } = await db.User.findOne({ + where: { + username: req.user.username }, - { transaction } - ); + lock: transaction.LOCK.UPDATE, + transaction + }); if (amount !== balance && amount + fee > balance) { l("amount exceeds balance", amount, fee, balance); |
