From 8c948d08c720e4b79e50283ee312492423315483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Fri, 24 Sep 2021 19:32:42 +0100 Subject: [PATCH] fix: rename argument for fee discount calculation --- lib/plugins/wallet/bitcoind/bitcoind.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/plugins/wallet/bitcoind/bitcoind.js b/lib/plugins/wallet/bitcoind/bitcoind.js index 81258e5e..7bd866e6 100644 --- a/lib/plugins/wallet/bitcoind/bitcoind.js +++ b/lib/plugins/wallet/bitcoind/bitcoind.js @@ -57,25 +57,25 @@ function estimateFee () { .catch(() => {}) } -function calculateFeeDiscount (feeDiscount) { +function calculateFeeDiscount (feeMultiplier) { // 0 makes bitcoind do automatic fee selection const AUTOMATIC_FEE = 0 - if (!feeDiscount) return AUTOMATIC_FEE + if (!feeMultiplier) return AUTOMATIC_FEE return estimateFee() .then(estimatedFee => { if (!estimatedFee) return AUTOMATIC_FEE - const newFee = estimatedFee.times(feeDiscount) + const newFee = estimatedFee.times(feeMultiplier) if (newFee.lt(0.00001) || newFee.gt(0.1)) return AUTOMATIC_FEE return newFee }) } -function sendCoins (account, tx, settings, operatorId, feeDiscount) { +function sendCoins (account, tx, settings, operatorId, feeMultiplier) { const { toAddress, cryptoAtoms, cryptoCode } = tx const coins = cryptoAtoms.shiftedBy(-unitScale).toFixed(8) return checkCryptoCode(cryptoCode) - .then(() => calculateFeeDiscount(feeDiscount)) + .then(() => calculateFeeDiscount(feeMultiplier)) .then(newFee => fetch('settxfee', [newFee])) .then(() => fetch('sendtoaddress', [toAddress, coins])) .then((txId) => fetch('gettransaction', [txId]))