From bb9974b8184ac9eb03d542e04a20feb3f9f10c70 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 10 Dec 2015 17:54:15 -0800 Subject: [PATCH] add master key reference to hd keys. --- lib/bcoin/hd.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/bcoin/hd.js b/lib/bcoin/hd.js index 4297e55e..6036419d 100644 --- a/lib/bcoin/hd.js +++ b/lib/bcoin/hd.js @@ -151,6 +151,8 @@ function HDPriv(options) { data = options; } + this.master = options.master || this; + data = this._normalize(data, network.prefixes.xprivkey); this.data = data; @@ -323,6 +325,7 @@ HDPriv.prototype.derive = function(index, hard) { var privateKey = leftPart.add(new bn(this.privateKey)).mod(ec.curve.n).toArray(); return new HDPriv({ + master: this.master, // version: this.version, depth: this.depth + 1, parentFingerPrint: this.fingerPrint,