From d919230124ec5dc72c1987336e218c3389ef7255 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 12 Dec 2014 00:21:42 -0300 Subject: [PATCH] add subscribe to initial shared address --- js/models/PublicKeyRing.js | 1 + js/models/Wallet.js | 3 ++- js/services/identityService.js | 9 +++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/js/models/PublicKeyRing.js b/js/models/PublicKeyRing.js index c279bcd2b..97364e2b0 100644 --- a/js/models/PublicKeyRing.js +++ b/js/models/PublicKeyRing.js @@ -498,6 +498,7 @@ PublicKeyRing.prototype.getCosigner = function(pubKey) { PublicKeyRing.prototype.buildAddressCache = function() { var ret = []; var self = this; + _.each(this.indexes, function(index) { for (var i = 0; i < index.receiveIndex; i++) { self._getAddress(i, false, index.copayerIndex); diff --git a/js/models/Wallet.js b/js/models/Wallet.js index 1b503e61d..2180b7895 100644 --- a/js/models/Wallet.js +++ b/js/models/Wallet.js @@ -350,6 +350,7 @@ Wallet.prototype._onPublicKeyRing = function(senderId, data) { } if (this.publicKeyRing.isComplete()) { this._lockIncomming(); + this.subscribeToAddresses(); this.emitAndKeepAlive('ready'); } else { this.emitAndKeepAlive('publicKeyRingUpdated'); @@ -739,7 +740,7 @@ Wallet.prototype._onData = function(senderId, data, ts) { this._onSignature(senderId, data); break; case 'indexes': - this._onIndexes(data.indexes); + this._onIndexes(senderId, data); break; case 'addressbook': this._onAddressBook(senderId, data); diff --git a/js/services/identityService.js b/js/services/identityService.js index de4f9bf04..1aadaa817 100644 --- a/js/services/identityService.js +++ b/js/services/identityService.js @@ -140,7 +140,7 @@ angular.module('copayApp.services') }; root.notifyTxProposalEvent = function(w, e) { - if (e.cId == w.getMyCopayerId()) + if (e.cId == w.getMyCopayerId()) return; var user = w.publicKeyRing.nicknameForCopayer(e.cId); @@ -227,7 +227,7 @@ angular.module('copayApp.services') // w.on('paymentACK', function(memo) { // notification.success('Payment Acknowledged', memo); // }); - + w.on('txProposalEvent', function(ev) { if (root.isFocused(wid)) { @@ -241,7 +241,7 @@ angular.module('copayApp.services') }, root.isFocused(wid)); root.notifyTxProposalEvent(w, ev); - $timeout(function(){ + $timeout(function() { $rootScope.$digest(); }); }); @@ -269,7 +269,8 @@ angular.module('copayApp.services') root.setupGlobalVariables(iden); iden.on('newWallet', function(wid) { var w = iden.getWalletById(wid); - copay.logger.debug('newWallet:', w.getName(), wid, iden.getLastFocusedWalletId()); + copay.logger.debug('newWallet:', + w.getName(), wid, iden.getLastFocusedWalletId()); root.installWalletHandlers(w); if (wid == iden.getLastFocusedWalletId()) { copay.logger.debug('GOT Focused wallet:', w.getName());