|
|
@ -1352,12 +1352,12 @@ WalletService.prototype._selectTxInputs = function(txp, utxosToExclude, cb) { |
|
|
|
|
|
|
|
log.debug('Tx size: ' + Utils.formatSize(txpSize) + ', Tx fee: ' + Utils.formatAmountInBtc(txpFee)); |
|
|
|
|
|
|
|
var amountVsFeeRatio = txpFee / txpAmount; |
|
|
|
var singleInputFeeVsFeeRatio = txpFee / (baseTxpFee + feePerInput); |
|
|
|
var feeVsAmountRatio = txpFee / txpAmount; |
|
|
|
var feeVsSingleInputFeeRatio = txpFee / (baseTxpFee + feePerInput); |
|
|
|
var amountVsUtxoRatio = inputAmount / txpAmount; |
|
|
|
|
|
|
|
log.debug('Tx amount/Fee: ' + Utils.formatRatio(amountVsFeeRatio) + ' (max: ' + Utils.formatRatio(Defaults.UTXO_SELECTION_MAX_TX_AMOUNT_VS_FEE_FACTOR) + ')'); |
|
|
|
log.debug('Single-input fee/Multi-input fee: ' + Utils.formatRatio(singleInputFeeVsFeeRatio) + ' (max: ' + Utils.formatRatio(Defaults.UTXO_SELECTION_MAX_FEE_VS_SINGLE_UTXO_FEE_FACTOR) + ')' + ' loses wrt single-input tx: ' + Utils.formatAmountInBtc((selected.length - 1) * feePerInput)); |
|
|
|
log.debug('Tx amount/Fee: ' + Utils.formatRatio(feeVsAmountRatio) + ' (max: ' + Utils.formatRatio(Defaults.UTXO_SELECTION_MAX_FEE_VS_TX_AMOUNT_FACTOR) + ')'); |
|
|
|
log.debug('Single-input fee/Multi-input fee: ' + Utils.formatRatio(feeVsSingleInputFeeRatio) + ' (max: ' + Utils.formatRatio(Defaults.UTXO_SELECTION_MAX_FEE_VS_SINGLE_UTXO_FEE_FACTOR) + ')' + ' loses wrt single-input tx: ' + Utils.formatAmountInBtc((selected.length - 1) * feePerInput)); |
|
|
|
log.debug('Tx amount/input amount:' + Utils.formatRatio(amountVsUtxoRatio) + ' (min: ' + Utils.formatRatio(Defaults.UTXO_SELECTION_MIN_TX_AMOUNT_VS_UTXO_FACTOR) + ')'); |
|
|
|
|
|
|
|
if (txpSize / 1000. > Defaults.MAX_TX_SIZE_IN_KB) { |
|
|
@ -1367,8 +1367,8 @@ WalletService.prototype._selectTxInputs = function(txp, utxosToExclude, cb) { |
|
|
|
} |
|
|
|
|
|
|
|
if (!_.isEmpty(bigInputs)) { |
|
|
|
if ((amountVsFeeRatio > Defaults.UTXO_SELECTION_MAX_TX_AMOUNT_VS_FEE_FACTOR && |
|
|
|
singleInputFeeVsFeeRatio > Defaults.UTXO_SELECTION_MAX_FEE_VS_SINGLE_UTXO_FEE_FACTOR)) { |
|
|
|
if ((feeVsAmountRatio > Defaults.UTXO_SELECTION_MAX_FEE_VS_TX_AMOUNT_FACTOR && |
|
|
|
feeVsSingleInputFeeRatio > Defaults.UTXO_SELECTION_MAX_FEE_VS_SINGLE_UTXO_FEE_FACTOR)) { |
|
|
|
log.debug('Breaking because fee exceeded fee/amount ratio and fee is too expensive compared to single input tx'); |
|
|
|
return false; |
|
|
|
} |
|
|
|