this is faster for some reason.
This commit is contained in:
parent
0dabee0336
commit
0f40d78f9e
@ -702,37 +702,29 @@ HDPrivateKey.prototype._build = function _build(data) {
|
|||||||
this.privateKey = data.privateKey;
|
this.privateKey = data.privateKey;
|
||||||
this.checksum = null;
|
this.checksum = null;
|
||||||
|
|
||||||
this.xprivkey = xprivkey;
|
|
||||||
this.fingerPrint = fingerPrint;
|
this.fingerPrint = fingerPrint;
|
||||||
this.publicKey = publicKey;
|
this.publicKey = publicKey;
|
||||||
|
this.key = key;
|
||||||
|
|
||||||
this.hdPrivateKey = this;
|
this.hdPrivateKey = this;
|
||||||
this.key = key;
|
this.xprivkey = xprivkey;
|
||||||
|
|
||||||
|
this.hdPublicKey = new HDPublicKey({
|
||||||
|
network: this.network,
|
||||||
|
data: {
|
||||||
|
key: this.key,
|
||||||
|
version: network[this.network].prefixes.xpubkey,
|
||||||
|
depth: this.depth,
|
||||||
|
parentFingerPrint: this.parentFingerPrint,
|
||||||
|
childIndex: this.childIndex,
|
||||||
|
chainCode: this.chainCode,
|
||||||
|
checksum: this.checksum,
|
||||||
|
publicKey: this.publicKey
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.xpubkey = this.hdPublicKey.xpubkey;
|
||||||
};
|
};
|
||||||
|
|
||||||
HDPrivateKey.prototype.__defineGetter__('xpubkey', function() {
|
|
||||||
return this.hdPublicKey.xpubkey;
|
|
||||||
});
|
|
||||||
|
|
||||||
HDPrivateKey.prototype.__defineGetter__('hdPublicKey', function() {
|
|
||||||
if (!this._hdPublicKey) {
|
|
||||||
this._hdPublicKey = new HDPublicKey({
|
|
||||||
network: this.network,
|
|
||||||
data: {
|
|
||||||
key: this.key,
|
|
||||||
version: network[this.network].prefixes.xpubkey,
|
|
||||||
depth: this.depth,
|
|
||||||
parentFingerPrint: this.parentFingerPrint,
|
|
||||||
childIndex: this.childIndex,
|
|
||||||
chainCode: this.chainCode,
|
|
||||||
checksum: this.checksum,
|
|
||||||
publicKey: this.publicKey
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return this._hdPublicKey;
|
|
||||||
});
|
|
||||||
|
|
||||||
HDPrivateKey.prototype.derive = function derive(index, hardened) {
|
HDPrivateKey.prototype.derive = function derive(index, hardened) {
|
||||||
var cached, data, hash, leftPart, chainCode, privateKey, child;
|
var cached, data, hash, leftPart, chainCode, privateKey, child;
|
||||||
var off = 0;
|
var off = 0;
|
||||||
@ -1084,11 +1076,15 @@ HDPublicKey.prototype._build = function _build(data) {
|
|||||||
this.publicKey = publicKey;
|
this.publicKey = publicKey;
|
||||||
this.checksum = null;
|
this.checksum = null;
|
||||||
|
|
||||||
|
this.fingerPrint = fingerPrint;
|
||||||
|
this.privateKey = null;
|
||||||
|
this.key = data.key || bcoin.keypair({ publicKey: this.publicKey });
|
||||||
|
|
||||||
this.hdPublicKey = this;
|
this.hdPublicKey = this;
|
||||||
this.xpubkey = xpubkey;
|
this.xpubkey = xpubkey;
|
||||||
this.fingerPrint = fingerPrint;
|
|
||||||
|
|
||||||
this.key = data.key || bcoin.keypair({ publicKey: this.publicKey });
|
this.hdPrivateKey = null;
|
||||||
|
this.xprivkey = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
HDPublicKey.prototype.derive = function derive(index, hardened) {
|
HDPublicKey.prototype.derive = function derive(index, hardened) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user