diff options
| author | Adrien Hopkins <[email protected]> | 2022-06-07 16:56:24 -0500 |
|---|---|---|
| committer | Adrien Hopkins <[email protected]> | 2022-06-07 16:56:24 -0500 |
| commit | 52716276db81bf8b9559cc2b361927d7be836897 (patch) | |
| tree | 4a43a03cf5da8ee97c4e21283eefa71dedfa6e42 | |
| parent | 8fcd976a04d1cfffdf84306c39a4d6c526aa0a22 (diff) | |
| download | coinos-server-52716276db81bf8b9559cc2b361927d7be836897.tar.gz coinos-server-52716276db81bf8b9559cc2b361927d7be836897.zip | |
Withdrawal credits can be used to reduce the withdrawal fee
| -rw-r--r-- | routes/bitcoin/send.js | 2 | ||||
| -rw-r--r-- | routes/liquid/send.js | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/routes/bitcoin/send.js b/routes/bitcoin/send.js index efcedb38..a9c95b31 100644 --- a/routes/bitcoin/send.js +++ b/routes/bitcoin/send.js @@ -68,11 +68,11 @@ module.exports = ah(async (req, res) => { } // use user's credits to reduce fee, if available - console.log(account.fee_credits); let withdrawalFeeDeduction = Math.min(account.fee_credits, withdrawalFee); if (withdrawalFeeDeduction) { await account.decrement({ fee_credits: withdrawalFeeDeduction }, { transaction }); await account.reload({ transaction }); + withdrawalFee -= withdrawalFeeDeduction; } await account.decrement({ balance: (total + withdrawalFee) }, { transaction }); diff --git a/routes/liquid/send.js b/routes/liquid/send.js index 8e21e4d4..fcb05942 100644 --- a/routes/liquid/send.js +++ b/routes/liquid/send.js @@ -137,6 +137,7 @@ sendLiquid = async ({ asset, amount, user, address, memo, tx, limit }) => { if (withdrawalFeeDeduction) { await account.decrement({ fee_credits: withdrawalFeeDeduction }, { transaction }); await account.reload({ transaction }); + withdrawalFee -= withdrawalFeeDeduction; } await account.decrement({ balance: (total + withdrawalFee)}, { transaction }); |
