From 3104220f1b253f6b741e3781a5ee71cd79c8c860 Mon Sep 17 00:00:00 2001 From: Daniel McNally Date: Thu, 12 Oct 2017 02:49:12 -0400 Subject: [PATCH 1/2] Allow --watch without accountKey value Fixes a bug with `cli wallet create` where if no value is specified for the --watch option, the accountKey is assigned a value of "true" which is invalid and causes errors downstream. This fix leaves accountKey as null, and the resulting functionality appears to match wallet creation via HTTP request where `watchOnly` is true and `accountKey` is not given a value. --- bin/cli | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/cli b/bin/cli index 77abe537..bb438fa5 100755 --- a/bin/cli +++ b/bin/cli @@ -58,7 +58,8 @@ CLI.prototype.createWallet = async function createWallet() { if (this.config.has('watch')) { options.watchOnly = true; - options.accountKey = this.config.str('watch'); + if (this.config.str('watch') != 'true') + options.accountKey = this.config.str('watch'); } const wallet = await this.client.createWallet(options); From 126a24479a0f5669c464bf4e3cda866592bd7a2d Mon Sep 17 00:00:00 2001 From: Daniel McNally Date: Fri, 13 Oct 2017 13:25:38 -0400 Subject: [PATCH 2/2] Create distinct --key & --watch Creates a separate --key argument to be separate from --watch and avoid confusion. --- bin/cli | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/bin/cli b/bin/cli index bb438fa5..2f6f77a5 100755 --- a/bin/cli +++ b/bin/cli @@ -52,16 +52,10 @@ CLI.prototype.createWallet = async function createWallet() { n: this.config.uint('n'), witness: this.config.bool('witness'), passphrase: this.config.str('passphrase'), - watchOnly: false, - accountKey: null + watchOnly: this.config.has('key') ? true : this.config.bool('watch'), + accountKey: this.config.str('key') }; - if (this.config.has('watch')) { - options.watchOnly = true; - if (this.config.str('watch') != 'true') - options.accountKey = this.config.str('watch'); - } - const wallet = await this.client.createWallet(options); this.log(wallet); @@ -127,7 +121,7 @@ CLI.prototype.createAccount = async function createAccount() { m: this.config.uint('m'), n: this.config.uint('n'), witness: this.config.bool('witness'), - accountKey: this.config.str('watch') + accountKey: this.config.str('key') }; const account = await this.wallet.createAccount(name, options);