Browse Source

Neaten multisig checks

master
Luke Childs 5 years ago
parent
commit
e577d12523
  1. 10
      src/index.js

10
src/index.js

@ -46,18 +46,22 @@ class Vain extends Emitter {
throw new Error('An xpub string must be passed in');
}
if (this.options.keyFormat === 'multisig' && this.options.addressFormat !== 'p2sh') {
if (this.options.keyFormat === 'multisig') {
if (this.options.addressFormat !== 'p2sh') {
throw new Error('When using key format "multisig" address format must be "p2sh"');
}
if (this.options.keyFormat === 'multisig' && typeof this.options.pubkeys === 'undefined') {
if (typeof this.options.pubkeys === 'undefined') {
// eslint-disable-next-line unicorn/prefer-type-error
throw new Error('When using key format "multisig" a "pubkeys" array must be passed in');
}
if (this.options.keyFormat === 'multisig' && typeof this.options.m !== 'number') {
if (typeof this.options.m !== 'number') {
// eslint-disable-next-line unicorn/prefer-type-error
throw new Error('When using key format "multisig" an "m" value must be passed in');
}
}
}
generate() {
this.generating = true;

Loading…
Cancel
Save