From 52716276db81bf8b9559cc2b361927d7be836897 Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Tue, 7 Jun 2022 16:56:24 -0500 Subject: Withdrawal credits can be used to reduce the withdrawal fee --- routes/bitcoin/send.js | 2 +- routes/liquid/send.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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 }); -- cgit v1.2.3