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]))