diff --git a/lib/server.js b/lib/server.js index 7acdd0f..c56b490 100644 --- a/lib/server.js +++ b/lib/server.js @@ -1279,22 +1279,17 @@ WalletService.prototype._selectTxInputs = function(txp, utxosToExclude, cb) { var sizePerInput = txp.getEstimatedSizeForSingleInput(); var feePerInput = sizePerInput * txp.feePerKb / 1000.; - function excludeUtxos(utxos) { + function sanitizeUtxos(utxos) { var excludeIndex = _.reduce(utxosToExclude, function(res, val) { res[val] = val; return res; }, {}); - return _.reject(utxos, function(utxo) { - return excludeIndex[utxo.txid + ":" + utxo.vout]; - }); - }; - - function sanitizeUtxos(utxos) { return _.filter(utxos, function(utxo) { if (utxo.locked) return false; if (utxo.satoshis <= feePerInput) return false; if (txp.excludeUnconfirmedUtxos && !utxo.confirmations) return false; + if (excludeIndex[utxo.txid + ":" + utxo.vout]) return false; return true; }); }; @@ -1415,8 +1410,6 @@ WalletService.prototype._selectTxInputs = function(txp, utxosToExclude, cb) { self._getUtxosForCurrentWallet(null, function(err, utxos) { if (err) return cb(err); - utxos = excludeUtxos(utxos); - var totalAmount; var availableAmount;