From c2d0d59955c6e2d51f3d89db95066118a92ad6c2 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Tue, 22 Dec 2015 17:13:50 -0300 Subject: [PATCH] fix border condition --- lib/server.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/server.js b/lib/server.js index c7304e5..6a7c4fe 100644 --- a/lib/server.js +++ b/lib/server.js @@ -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();