Merge pull request #478 from maraoz/optimize/address-creation

optimize address generation protocol
This commit is contained in:
Matias Alejo Garcia 2014-05-27 18:06:49 -03:00
commit 4470ab7458
1 changed files with 6 additions and 7 deletions

View File

@ -77,19 +77,18 @@ console.log('[Wallet.js.58] connecting'); //TODO
Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
this.log('RECV PUBLICKEYRING:', data);
var recipients, pkr = this.publicKeyRing;
var inPKR = copay.PublicKeyRing.fromObj(data.publicKeyRing);
var wasIncomplete = !this.publicKeyRing.isComplete();
var hasChanged = this.publicKeyRing.merge(inPKR, true);
var hasChanged = pkr.merge(inPKR, true);
if (hasChanged) {
this.connectToAll();
if (wasIncomplete) {
this.sendPublicKeyRing();
this.connectToAll();
}
if (this.publicKeyRing.isComplete()) {
this._lockIncomming();
}
this.log('### BROADCASTING PKR');
recipients = null;
this.sendPublicKeyRing(recipients);
}
this.emit('publicKeyRingUpdated');
this.store();