mirror of https://github.com/BTCPrivate/copay.git
filter unspent
This commit is contained in:
parent
a778cc71a1
commit
78b84fc466
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue