From d5a794afffe691085668099bbc8fd2ba591e3169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Tue, 24 May 2022 15:25:31 +0100 Subject: [PATCH] fix: BTC multiplied fee rounding --- lib/plugins/wallet/bitcoind/bitcoind.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/plugins/wallet/bitcoind/bitcoind.js b/lib/plugins/wallet/bitcoind/bitcoind.js index 6d7c8da3..43e994b8 100644 --- a/lib/plugins/wallet/bitcoind/bitcoind.js +++ b/lib/plugins/wallet/bitcoind/bitcoind.js @@ -69,7 +69,7 @@ function calculateFeeDiscount (feeMultiplier) { if (!estimatedFee) return AUTOMATIC_FEE const newFee = estimatedFee.times(feeMultiplier) if (newFee.lt(0.00001) || newFee.gt(0.1)) return AUTOMATIC_FEE - return newFee + return newFee.toFixed(8) }) } @@ -79,7 +79,7 @@ function sendCoins (account, tx, settings, operatorId, feeMultiplier) { return checkCryptoCode(cryptoCode) .then(() => calculateFeeDiscount(feeMultiplier)) - .then(newFee => fetch('settxfee', [newFee.toNumber()])) + .then(newFee => fetch('settxfee', [newFee])) .then(() => fetch('sendtoaddress', [toAddress, coins])) .then((txId) => fetch('gettransaction', [txId])) .then((res) => _.pick(['fee', 'txid'], res)) @@ -95,7 +95,7 @@ function sendCoins (account, tx, settings, operatorId, feeMultiplier) { function sendCoinsBatch (account, txs, cryptoCode, feeMultiplier) { return checkCryptoCode(cryptoCode) .then(() => calculateFeeDiscount(feeMultiplier)) - .then(newFee => fetch('settxfee', [newFee.toNumber()])) + .then(newFee => fetch('settxfee', [newFee])) .then(() => _.reduce((acc, value) => ({ ...acc, [value.toAddress]: _.isNil(acc[value.toAddress])