diff --git a/lib/plugins/wallet/bitcoind/bitcoind.js b/lib/plugins/wallet/bitcoind/bitcoind.js index b6a71684..efb1444d 100644 --- a/lib/plugins/wallet/bitcoind/bitcoind.js +++ b/lib/plugins/wallet/bitcoind/bitcoind.js @@ -63,15 +63,20 @@ function estimateFee () { }) } -function calculateFeeDiscount (feeMultiplier) { +function calculateFeeDiscount (feeMultiplier = 1) { // 0 makes bitcoind do automatic fee selection const AUTOMATIC_FEE = 0 - if (!feeMultiplier || feeMultiplier.eq(1)) return AUTOMATIC_FEE return estimateFee() .then(estimatedFee => { - if (!estimatedFee) return AUTOMATIC_FEE + if (!estimatedFee) { + logger.info('failure estimating fee, using bitcoind automatic fee selection') + return AUTOMATIC_FEE + } const newFee = estimatedFee.times(feeMultiplier) - if (newFee.lt(0.00001) || newFee.gt(0.1)) return AUTOMATIC_FEE + if (newFee.lt(0.00001) || newFee.gt(0.1)) { + logger.info('fee outside safety parameters, defaulting to automatic fee selection') + return AUTOMATIC_FEE + } return newFee.toFixed(8) }) }