From ed4e7b124316a24c6c46bac7153a34a6699c10ce Mon Sep 17 00:00:00 2001 From: Bucko Date: Thu, 24 Aug 2017 17:19:05 -0700 Subject: [PATCH] pass options on keyring creation --- lib/primitives/keyring.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/primitives/keyring.js b/lib/primitives/keyring.js index b7d9830b1..e5cb9ec77 100644 --- a/lib/primitives/keyring.js +++ b/lib/primitives/keyring.js @@ -63,6 +63,16 @@ KeyRing.prototype.fromOptions = function fromOptions(options, network) { let key = toKey(options); + if (options.witness != null) { + assert(typeof options.witness === 'boolean'); + this.witness = options.witness; + } + + if (options.nested != null) { + assert(typeof options.nested === 'boolean'); + this.nested = options.nested; + } + if (Buffer.isBuffer(key)) return this.fromKey(key, network); @@ -74,16 +84,6 @@ KeyRing.prototype.fromOptions = function fromOptions(options, network) { if (options.privateKey) key = toKey(options.privateKey); - if (options.witness != null) { - assert(typeof options.witness === 'boolean'); - this.witness = options.witness; - } - - if (options.nested != null) { - assert(typeof options.nested === 'boolean'); - this.nested = options.nested; - } - const script = options.script; const compress = options.compressed;