fix safeUnspents report

This commit is contained in:
Matias Alejo Garcia 2014-06-05 14:55:19 -03:00
parent be4f6dbadd
commit c64bf07ae3
6 changed files with 19 additions and 13 deletions

View File

@ -23,12 +23,12 @@ var defaultConfig = {
// Use this to connect to bitpay's PeerJS server
key: 'satoshirocks',
host: '162.242.219.26',
port: 80,
port: 10000,
path: '/',
// other PeerJS config
maxPeers: 15,
debug: 3,
debug: 1,
// Network encryption config
sjclParams: {

View File

@ -82,7 +82,7 @@
</div>
</div>
<div class="row" ng-if='$root.insightError>1'>
<div class="row" ng-if='$root.insightError>0'>
<div class="small-8 large-centered columns">
<div data-alert class="alert-box radius error">
Having troubles connecting to Insight server. Check

View File

@ -35,14 +35,15 @@ angular.module('copayApp.controllers').controller('HeaderController',
// Initialize alert notification (not show when init wallet)
$rootScope.txAlertCount = 0;
$rootScope.insightError = -1;
$rootScope.insightError = 0;
$rootScope.$watch('insightError', function(status) {
if (status === 0) {
if (status === -1) {
$rootScope.$flashMessage = {
type: 'success',
message: 'Networking Restored :)',
};
$rootScope.insightError = 0;
}
});

View File

@ -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;

View File

@ -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);

View File

@ -174,7 +174,6 @@ angular.module('copayApp.services')
};
root._setCommError = function(e) {
// first error ever?
if ($rootScope.insightError<0)
$rootScope.insightError=0;
$rootScope.insightError++;
@ -182,7 +181,10 @@ angular.module('copayApp.services')
root._clearCommError = function(e) {
$rootScope.insightError=0;
if ($rootScope.insightError>0)
$rootScope.insightError=-1;
else
$rootScope.insightError=0;
};
root.setSocketHandlers = function() {