diff options
| author | Adam Soltys <[email protected]> | 2021-01-13 22:32:13 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-01-13 22:32:13 -0800 |
| commit | d03dad4d85ccd107068719c4b68cbd6a255864f6 (patch) | |
| tree | 224a1ad8caa3f2abdab3d35b8a564cdf4c98c233 /lib | |
| parent | b605dd257984d3384c680de2cf64e44bfd3484ca (diff) | |
| download | coinos-server-d03dad4d85ccd107068719c4b68cbd6a255864f6.tar.gz coinos-server-d03dad4d85ccd107068719c4b68cbd6a255864f6.zip | |
use decrement operation in lightning send
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/send.js | 7 |
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( { |
