more hd optimization.
This commit is contained in:
parent
00eba20c4e
commit
aadb1fb4e0
@ -619,7 +619,7 @@ HDPrivateKey.prototype._generate = function _generate(privateKey, entropy) {
|
|||||||
if (utils.isHex(privateKey))
|
if (utils.isHex(privateKey))
|
||||||
privateKey = new Buffer(privateKey, 'hex');
|
privateKey = new Buffer(privateKey, 'hex');
|
||||||
else if (utils.isBase58(privateKey))
|
else if (utils.isBase58(privateKey))
|
||||||
privateKey = bcoin.keypair.fromSecret(privateKey).getPrivateKey();
|
privateKey = bcoin.keypair._fromSecret(privateKey).privateKey;
|
||||||
|
|
||||||
if (!entropy)
|
if (!entropy)
|
||||||
entropy = new Buffer(elliptic.rand(32));
|
entropy = new Buffer(elliptic.rand(32));
|
||||||
@ -689,7 +689,6 @@ HDPrivateKey.prototype._build = function _build(data) {
|
|||||||
xprivkey = utils.toBase58(sequence);
|
xprivkey = utils.toBase58(sequence);
|
||||||
|
|
||||||
key = bcoin.keypair({ privateKey: data.privateKey });
|
key = bcoin.keypair({ privateKey: data.privateKey });
|
||||||
privateKey = key.getPrivateKey();
|
|
||||||
publicKey = key.getPublicKey();
|
publicKey = key.getPublicKey();
|
||||||
|
|
||||||
size = constants.hd.parentFingerPrintSize;
|
size = constants.hd.parentFingerPrintSize;
|
||||||
@ -700,7 +699,7 @@ HDPrivateKey.prototype._build = function _build(data) {
|
|||||||
this.parentFingerPrint = data.parentFingerPrint;
|
this.parentFingerPrint = data.parentFingerPrint;
|
||||||
this.childIndex = data.childIndex;
|
this.childIndex = data.childIndex;
|
||||||
this.chainCode = data.chainCode;
|
this.chainCode = data.chainCode;
|
||||||
this.privateKey = privateKey;
|
this.privateKey = data.privateKey;
|
||||||
this.checksum = null;
|
this.checksum = null;
|
||||||
|
|
||||||
this.xprivkey = xprivkey;
|
this.xprivkey = xprivkey;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user