diff --git a/lib/bcoin/hd.js b/lib/bcoin/hd.js index 160863c1..77ce3d3a 100644 --- a/lib/bcoin/hd.js +++ b/lib/bcoin/hd.js @@ -522,7 +522,7 @@ HDPublicKey.prototype._build = function _build(data) { }; HDPublicKey.prototype.derive = function derive(index, hardened) { - var data, hash, leftPart, chainCode, pair, pubkeyPoint, publicKey; + var data, hash, leftPart, chainCode, pair, point, publicKey; if (typeof index === 'string') return this.deriveString(index); @@ -539,8 +539,8 @@ HDPublicKey.prototype.derive = function derive(index, hardened) { chainCode = hash.slice(32, 64); pair = bcoin.ecdsa.keyPair({ pub: this.publicKey }); - pubkeyPoint = ec.curve.g.mul(leftPart).add(pair.pub); - publicKey = bcoin.ecdsa.keyFromPublic(pubkeyPoint).getPublic(true, 'array'); + point = ec.curve.g.mul(leftPart).add(pair.pub); + publicKey = bcoin.ecdsa.keyPair({ pub: point }).getPublic(true, 'array'); return new HDPublicKey({ version: null, diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index 6081b888..6a464d33 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -654,7 +654,7 @@ Wallet.fromJSON = function fromJSON(json, decrypt) { json.hd.seed.mnemonic = decrypt(json.hd.seed.mnemonic); json.hd.seed.passphrase = decrypt(json.hd.seed.passphrase); } - priv = new hd.priv(json.hd); + priv = bcoin.hd.priv(json.hd); } w = new Wallet({