From c200b0824ab8110999e4adee83549ed158d77995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Thu, 28 Oct 2021 21:12:52 +0100 Subject: [PATCH] fix: remove unnecessary config load and fee calculation --- lib/plugins/wallet/bitcoind/bitcoind.js | 2 +- lib/wallet.js | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/plugins/wallet/bitcoind/bitcoind.js b/lib/plugins/wallet/bitcoind/bitcoind.js index 7bd866e6..7166f769 100644 --- a/lib/plugins/wallet/bitcoind/bitcoind.js +++ b/lib/plugins/wallet/bitcoind/bitcoind.js @@ -60,7 +60,7 @@ function estimateFee () { function calculateFeeDiscount (feeMultiplier) { // 0 makes bitcoind do automatic fee selection const AUTOMATIC_FEE = 0 - if (!feeMultiplier) return AUTOMATIC_FEE + if (!feeMultiplier || feeMultiplier.eq(1)) return AUTOMATIC_FEE return estimateFee() .then(estimatedFee => { if (!estimatedFee) return AUTOMATIC_FEE diff --git a/lib/wallet.js b/lib/wallet.js index 4b090cf6..9391addb 100644 --- a/lib/wallet.js +++ b/lib/wallet.js @@ -60,11 +60,8 @@ function _balance (settings, cryptoCode) { function sendCoins (settings, tx) { return fetchWallet(settings, tx.cryptoCode) .then(r => { - return loadLatestConfig() - .then(config => { - const feeMultiplier = config[`wallets_${tx.cryptoCode}_feeMultiplier`] - return r.wallet.sendCoins(r.account, tx, settings, r.operatorId, feeMultiplier) - }) + const feeMultiplier = settings[`wallets_${tx.cryptoCode}_feeMultiplier`] + return r.wallet.sendCoins(r.account, tx, settings, r.operatorId, feeMultiplier) .then(res => { mem.clear(module.exports.balance) return res