fix border condition

This commit is contained in:
Ivan Socolsky 2015-12-22 17:13:50 -03:00
parent 08f37a97b6
commit c2d0d59955
1 changed files with 6 additions and 2 deletions

View File

@ -945,8 +945,13 @@ WalletService.prototype._totalizeUtxos = function(utxos) {
WalletService.prototype._computeBytesToSendMax = function(utxos, cb) {
var self = this;
var size = {
all: 0,
confirmed: 0
};
var unlockedUtxos = _.reject(utxos, 'locked');
if (_.isEmpty(unlockedUtxos)) return cb(null, 0);
if (_.isEmpty(unlockedUtxos)) return cb(null, size);
self.getWallet({}, function(err, wallet) {
if (err) return cb(err);
@ -957,7 +962,6 @@ WalletService.prototype._computeBytesToSendMax = function(utxos, cb) {
walletN: wallet.n,
});
var size = {};
txp.inputs = unlockedUtxos;
size.all = txp.getEstimatedSize();