diff --git a/lib/primitives/keyring.js b/lib/primitives/keyring.js index 7e8141f1..aeea5fc5 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;