Browse Source

refactor update pkr

activeAddress
Matias Alejo Garcia 10 years ago
parent
commit
089ca1fec6
  1. 19
      lib/model/wallet.js

19
lib/model/wallet.js

@ -89,15 +89,20 @@ Wallet.prototype.isShared = function() {
return this.n > 1;
};
Wallet.prototype._updatePublicKeyRing = function() {
this.publicKeyRing = _.map(this.copayers, function(copayer) {
return _.pick(copayer, ['xPubKey', 'requestPubKey', 'isTemporaryRequestKey']);
});
};
Wallet.prototype.addCopayer = function(copayer) {
this.copayers.push(copayer);
this.copayers.push(copayer);
if (this.copayers.length < this.n) return;
this.status = 'complete';
this.publicKeyRing = _.map(this.copayers, function(copayer) {
return _.pick(copayer, ['xPubKey', 'requestPubKey', 'isTemporaryRequestKey']);
});
this._updatePublicKeyRing();
};
Wallet.prototype.updateCopayerRequestKey = function(copayerId, requestPubKey) {
@ -108,13 +113,11 @@ Wallet.prototype.updateCopayerRequestKey = function(copayerId, requestPubKey) {
});
$.checkState(c)
.checkState(c.isTemporaryRequestKey);
.checkState(c.isTemporaryRequestKey);
c.requestPubKey = requestPubKey;
c.isTemporaryRequestKey = false;
this.publicKeyRing = _.map(this.copayers, function(copayer) {
return _.pick(copayer, ['xPubKey', 'requestPubKey', 'isTemporaryRequestKey']);
});
this._updatePublicKeyRing();
};
Wallet.prototype.getCopayer = function(copayerId) {

Loading…
Cancel
Save