fix safeUnspents report
This commit is contained in:
parent
be4f6dbadd
commit
c64bf07ae3
6 changed files with 19 additions and 13 deletions
|
|
@ -231,15 +231,17 @@ TxProposals.prototype.getTxProposal = function(ntxid, copayers) {
|
|||
return i;
|
||||
};
|
||||
|
||||
//returns the unspent txid-vout used in PENDING Txs
|
||||
TxProposals.prototype.getUsedUnspent = function(maxRejectCount) {
|
||||
var ret = [];
|
||||
var ret = {};
|
||||
for(var i in this.txps) {
|
||||
var u = this.txps[i].builder.getSelectedUnspent();
|
||||
if (this.getTxProposal(i).rejectCount>maxRejectCount)
|
||||
var p = this.getTxProposal(i);
|
||||
if (p.rejectCount>maxRejectCount || p.sentTxid)
|
||||
continue;
|
||||
|
||||
for (var j in u){
|
||||
ret.push(u[j].txid);
|
||||
for (var j in u) {
|
||||
ret[u[j].txid + ',' + u[j].vout]=1;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -596,8 +596,9 @@ Wallet.prototype.getUnspent = function(cb) {
|
|||
var uu = self.txProposals.getUsedUnspent(maxRejectCount);
|
||||
|
||||
for (var i in unspentList) {
|
||||
if (uu.indexOf(unspentList[i].txid) === -1)
|
||||
safeUnspendList.push(unspentList[i]);
|
||||
var u=unspentList[i];
|
||||
if (! uu[u.txid +','+u.vout])
|
||||
safeUnspendList.push(u);
|
||||
}
|
||||
|
||||
return cb(null, safeUnspendList, unspentList);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue