diff options
| author | Adam Soltys <[email protected]> | 2021-01-15 15:31:46 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-01-15 15:31:46 -0800 |
| commit | d01159ce9eee956dca32fd69525c0edd5aae9477 (patch) | |
| tree | e6a4d4a928daffb5bcedbc3411a0dfded6ff422f /routes/bitcoin/receive.js | |
| parent | d03dad4d85ccd107068719c4b68cbd6a255864f6 (diff) | |
| download | coinos-server-d01159ce9eee956dca32fd69525c0edd5aae9477.tar.gz coinos-server-d01159ce9eee956dca32fd69525c0edd5aae9477.zip | |
add more transactions and locks
Diffstat (limited to 'routes/bitcoin/receive.js')
| -rw-r--r-- | routes/bitcoin/receive.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/routes/bitcoin/receive.js b/routes/bitcoin/receive.js index e0e3828b..2a6a7954 100644 --- a/routes/bitcoin/receive.js +++ b/routes/bitcoin/receive.js @@ -159,10 +159,13 @@ setInterval(async () => { let total = p.amount + p.tip; p.confirmed = 1; - p.account.balance += total; - p.account.pending -= Math.min(p.account.pending, total); - await p.account.save({ transaction }); + await p.account.increment({ balance: total }, { transaction }); + await p.account.decrement( + { pending: Math.min(p.account.pending, total) }, + { transaction } + ); + await p.account.reload({ transaction }); await p.save({ transaction }); p = p.get({ plain: true }); |
