fix params
This commit is contained in:
parent
b1b8a44a7d
commit
8b42f8508b
2 changed files with 9 additions and 4 deletions
|
|
@ -161,7 +161,7 @@ PublicKeyRing.prototype.addCopayer = function (newEpk) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
PublicKeyRing.prototype.getCopayersPubKeys = function () {
|
PublicKeyRing.prototype.getCopayersPubKeys = function (index, isChange) {
|
||||||
this._checkKeys();
|
this._checkKeys();
|
||||||
|
|
||||||
var pubKeys = [];
|
var pubKeys = [];
|
||||||
|
|
@ -186,7 +186,7 @@ PublicKeyRing.prototype._checkIndexRange = function (index, isChange) {
|
||||||
PublicKeyRing.prototype.getRedeemScript = function (index, isChange) {
|
PublicKeyRing.prototype.getRedeemScript = function (index, isChange) {
|
||||||
this._checkIndexRange(index, isChange);
|
this._checkIndexRange(index, isChange);
|
||||||
|
|
||||||
var pubKeys = this.getCopayersPubKeys();
|
var pubKeys = this.getCopayersPubKeys(index, isChange);
|
||||||
var script = Script.createMultisig(this.requiredCopayers, pubKeys);
|
var script = Script.createMultisig(this.requiredCopayers, pubKeys);
|
||||||
return script;
|
return script;
|
||||||
};
|
};
|
||||||
|
|
@ -207,9 +207,9 @@ PublicKeyRing.prototype.generateAddress = function(isChange) {
|
||||||
var ret =
|
var ret =
|
||||||
this.getAddress(isChange ? this.changeAddressIndex : this.addressIndex, isChange);
|
this.getAddress(isChange ? this.changeAddressIndex : this.addressIndex, isChange);
|
||||||
if (isChange)
|
if (isChange)
|
||||||
this.addressIndex++;
|
|
||||||
else
|
|
||||||
this.changeAddressIndex++;
|
this.changeAddressIndex++;
|
||||||
|
else
|
||||||
|
this.addressIndex++;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,11 @@ describe('PublicKeyRing model', function() {
|
||||||
a.isValid().should.equal(true);
|
a.isValid().should.equal(true);
|
||||||
a.isScript().should.equal(true);
|
a.isScript().should.equal(true);
|
||||||
a.network().name.should.equal('livenet');
|
a.network().name.should.equal('livenet');
|
||||||
|
|
||||||
|
if (i>1) {
|
||||||
|
w.getAddress(i-1,isChange).should
|
||||||
|
.not.equal(w.getAddress(i-2,isChange));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue