From 31cab73193128f10e37a3fff1ebafc0868ddd5ee Mon Sep 17 00:00:00 2001 From: Matias Pando Date: Wed, 29 Oct 2014 14:53:52 -0300 Subject: [PATCH] adding message publicKeyRingUpdated --- js/models/Identity.js | 4 ++++ js/models/Wallet.js | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/js/models/Identity.js b/js/models/Identity.js index 0ea694285..b57f72a5d 100644 --- a/js/models/Identity.js +++ b/js/models/Identity.js @@ -390,6 +390,10 @@ Identity.prototype.bindWallet = function(w) { log.debug(' Wallet' + w.getName()); self.storeWallet(w); }); + w.on('publicKeyRingUpdated', function() { + log.debug(' Wallet' + w.getName()); + self.storeWallet(w); + }); }; /** diff --git a/js/models/Wallet.js b/js/models/Wallet.js index f9f067b7f..12935d98b 100644 --- a/js/models/Wallet.js +++ b/js/models/Wallet.js @@ -245,6 +245,14 @@ Wallet.prototype._newAddresses = function(dontUpdateUx) { this.emitAndKeepAlive('newAddresses', dontUpdateUx); }; + +Wallet.prototype._publicKeyRingUpdated = function(isComplete) { + if (isComplete) { + this.subscribeToAddresses(); + }; + this.emitAndKeepAlive('publicKeyRingUpdated'); +}; + /** * @desc Handles an 'indexes' message. * @@ -321,7 +329,8 @@ Wallet.prototype._onPublicKeyRing = function(senderId, data) { if (this.publicKeyRing.isComplete()) { this._lockIncomming(); } - this._newAddresses(); + + this._publicKeyRingUpdated(this.publicKeyRing.isComplete()); } };