From 377e15687403a7697170d92071331677c5bdeb32 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 5 Dec 2015 01:03:51 -0800 Subject: [PATCH] fix m, n, publicKeys in wallet constructor. --- lib/bcoin/wallet.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index c2be1abe..0fd52154 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -58,13 +58,13 @@ function Wallet(options, passphrase) { this.fee = 10000; this.dust = 5460; - if (options.m != null) { - this.m = options.m; - this.n = options.n; - this.publicKeys = options.publicKeys || []; + this.m = options.m || 1; + this.n = options.n || 1; + this.publicKeys = options.publicKeys; - if (this.n < this.publicKeys.length) { - this.publicKeys.push(this.getPublicKey('base58')); + if (this.publicKeys) { + if (this.publicKeys.length < this.n) { + this.publicKeys.push(this.getPublicKey()); } if (this.m < 1 || this.m > this.n) {