aboutsummaryrefslogtreecommitdiffstats
path: root/lib/send.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/send.js')
-rw-r--r--lib/send.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/send.js b/lib/send.js
index 733c3cfb..4e00f54a 100644
--- a/lib/send.js
+++ b/lib/send.js
@@ -29,6 +29,8 @@ send = async (amount, memo, hash, user) => {
}
let error, fee, total, preimage;
+ await account.decrement({ balance: amount }, { transaction });
+ await account.reload({ transaction });
if (config.lna.clightning) {
let m = await lna.pay(hash);
@@ -66,9 +68,8 @@ send = async (amount, memo, hash, user) => {
total = parseInt(total);
fee = parseInt(fee);
- await new Promise((resolve) => setTimeout(resolve, 5000));
- account.balance -= total;
- await account.save({ transaction });
+ await account.decrement({ balance: fee }, { transaction });
+ await account.reload({ transaction });
payment = await db.Payment.create(
{