aboutsummaryrefslogtreecommitdiffstats
path: root/lib/account.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2021-01-15 15:31:46 -0800
committerAdam Soltys <[email protected]>2021-01-15 15:31:46 -0800
commitd01159ce9eee956dca32fd69525c0edd5aae9477 (patch)
treee6a4d4a928daffb5bcedbc3411a0dfded6ff422f /lib/account.js
parentd03dad4d85ccd107068719c4b68cbd6a255864f6 (diff)
downloadcoinos-server-d01159ce9eee956dca32fd69525c0edd5aae9477.tar.gz
coinos-server-d01159ce9eee956dca32fd69525c0edd5aae9477.zip
add more transactions and locks
Diffstat (limited to 'lib/account.js')
-rw-r--r--lib/account.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/account.js b/lib/account.js
index 5a8c3924..ac09a8e8 100644
--- a/lib/account.js
+++ b/lib/account.js
@@ -33,9 +33,10 @@ module.exports = async (asset, user, transaction) => {
asset
},
order: [["id", "ASC"]],
- limit: 1
+ limit: 1,
+ lock: transaction.LOCK.UPDATE,
+ transaction
},
- { transaction }
);
if (existing) {
@@ -46,5 +47,5 @@ module.exports = async (asset, user, transaction) => {
params = { ...params, ...{ domain, ticker, precision, name } };
params.balance = 0;
params.pending = 0;
- return db.Account.create(params);
+ return db.Account.create(params, { transaction });
};