filter unspent
This commit is contained in:
parent
a778cc71a1
commit
78b84fc466
1 changed files with 7 additions and 1 deletions
|
|
@ -2172,11 +2172,17 @@ Wallet.prototype.getBalance = function(cb) {
|
||||||
var balanceByAddr = {};
|
var balanceByAddr = {};
|
||||||
var COIN = coinUtil.COIN;
|
var COIN = coinUtil.COIN;
|
||||||
|
|
||||||
this.getUnspent(function(err, safeUnspent, unspent) {
|
this.getUnspent(function(err, safeUnspent, unspentRaw) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return cb(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++) {
|
for (var i = 0; i < unspent.length; i++) {
|
||||||
var u = unspent[i];
|
var u = unspent[i];
|
||||||
var amt = u.amount * COIN;
|
var amt = u.amount * COIN;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue