optimize some tests
This commit is contained in:
parent
ff37bea6fb
commit
bca120a7b6
3 changed files with 21 additions and 17 deletions
|
|
@ -166,10 +166,7 @@ PublicKeyRing.prototype.getAddress = function (index, isChange) {
|
|||
this._checkIndexRange(index, isChange);
|
||||
|
||||
var script = this.getRedeemScript(index,isChange);
|
||||
var hash = coinUtil.sha256ripe160(script.getBuffer());
|
||||
var version = this.network.P2SHVersion;
|
||||
var addr = new Address(version, hash);
|
||||
return addr;
|
||||
return Address.fromScript(script, this.network.name);
|
||||
};
|
||||
|
||||
PublicKeyRing.prototype.getScriptPubKeyHex = function (index, isChange) {
|
||||
|
|
@ -185,10 +182,11 @@ PublicKeyRing.prototype.generateAddress = function(isChange) {
|
|||
|
||||
var ret =
|
||||
this.getAddress(isChange ? this.changeAddressIndex : this.addressIndex, isChange);
|
||||
if (isChange)
|
||||
if (isChange) {
|
||||
this.changeAddressIndex++;
|
||||
else
|
||||
} else {
|
||||
this.addressIndex++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue