add AddressIndex model

This commit is contained in:
Manuel Araoz 2014-06-04 13:44:32 -03:00
commit 51d5d7164e
8 changed files with 104 additions and 16 deletions

View file

@ -27,7 +27,7 @@ function PublicKeyRing(opts) {
this.copayersHK = opts.copayersHK || [];
this.indexes = opts.indexes || new ;
this.indexes = AddressIndex.fromObj(opts.indexes) || new AddressIndex(opts);
this.publicKeysCache = opts.publicKeysCache || {};
this.nicknameFor = opts.nicknameFor || {};
@ -159,7 +159,7 @@ PublicKeyRing.prototype.getPubKeys = function(index, isChange) {
// TODO this could be cached
PublicKeyRing.prototype.getRedeemScript = function (index, isChange) {
this._checkIndexRange(index, isChange);
this.indexes.checkRange(index, isChange);
var pubKeys = this.getPubKeys(index, isChange);
var script = Script.createMultisig(this.requiredCopayers, pubKeys);