Having troubles connecting to Insight server. Check
diff --git a/js/controllers/header.js b/js/controllers/header.js
index 757b67958..36b37459f 100644
--- a/js/controllers/header.js
+++ b/js/controllers/header.js
@@ -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;
}
});
diff --git a/js/models/core/TxProposals.js b/js/models/core/TxProposals.js
index 11cb2de56..10c2e1308 100644
--- a/js/models/core/TxProposals.js
+++ b/js/models/core/TxProposals.js
@@ -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;
diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js
index 6e7dca714..82448ef07 100644
--- a/js/models/core/Wallet.js
+++ b/js/models/core/Wallet.js
@@ -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);
diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js
index 898400ae2..516fdfee1 100644
--- a/js/services/controllerUtils.js
+++ b/js/services/controllerUtils.js
@@ -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() {