diff --git a/js/models/Wallet.js b/js/models/Wallet.js index 464732d8b..5d038277e 100644 --- a/js/models/Wallet.js +++ b/js/models/Wallet.js @@ -2172,11 +2172,17 @@ Wallet.prototype.getBalance = function(cb) { var balanceByAddr = {}; var COIN = coinUtil.COIN; - this.getUnspent(function(err, safeUnspent, unspent) { + this.getUnspent(function(err, safeUnspent, unspentRaw) { if (err) { return cb(err); } + // This filter out possible broken unspent, as reported on + // https://github.com/bitpay/copay/issues/1585 + // and later gitter conversation. + + var unspent = _.filter(unspentRaw, 'scriptPubKey'); + for (var i = 0; i < unspent.length; i++) { var u = unspent[i]; var amt = u.amount * COIN;