From 2c33c65c11ae97cffe4d392866d18284c858f311 Mon Sep 17 00:00:00 2001 From: iajrz Date: Thu, 17 Nov 2022 12:59:39 -0400 Subject: [PATCH] Addressing #1501 by making set- and get-validator LeanPocket aware Several things are happening here under that title; for one, get-validator and set-validator now detect whether LeanPocket is on; if it is, then they output a message suggesting you might be trying to run the plural version of the commands and exits. The messages in set-validators and get-validators were similarly adapted to suggest you might be trying to run the singular version of the command before exiting. Last and least, a the setValidatorsLean command was slightly edited so the whitespace around the check for LeanPocket matches the others. --- app/cmd/cli/accounts.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/cmd/cli/accounts.go b/app/cmd/cli/accounts.go index f96cace61..c1e4a800a 100644 --- a/app/cmd/cli/accounts.go +++ b/app/cmd/cli/accounts.go @@ -114,7 +114,7 @@ var getNodesLean = &cobra.Command{ app.InitConfig(datadir, tmNode, persistentPeers, seeds, remoteCLIURL) config := app.GlobalConfig if !config.PocketConfig.LeanPocket { - fmt.Println("Lean pocket is not enabled") + fmt.Println("Lean pocket is not enabled. You might be trying to use get-validator.") return } @@ -135,6 +135,11 @@ var getValidator = &cobra.Command{ Long: `Retrieves the main validator from the priv_val file`, Run: func(cmd *cobra.Command, args []string) { app.InitConfig(datadir, tmNode, persistentPeers, seeds, remoteCLIURL) + if app.GlobalConfig.PocketConfig.LeanPocket { + fmt.Println("Lean pocket is enabled. You might be trying to use get-validators.") + return + } + kb := app.MustGetKeybase() if kb == nil { fmt.Println(app.UninitializedKeybaseError.Error()) @@ -152,9 +157,8 @@ var setValidatorsLean = &cobra.Command{ Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { app.InitConfig(datadir, tmNode, persistentPeers, seeds, remoteCLIURL) - if !app.GlobalConfig.PocketConfig.LeanPocket { - fmt.Println("Lean pocket is not enabled") + fmt.Println("Lean pocket is not enabled. You might be trying to use set-validator.") return } @@ -179,6 +183,11 @@ var setValidator = &cobra.Command{ Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { app.InitConfig(datadir, tmNode, persistentPeers, seeds, remoteCLIURL) + if app.GlobalConfig.PocketConfig.LeanPocket { + fmt.Println("Lean pocket is enabled. You might be trying to use set-validators.") + return + } + addr, err := types.AddressFromHex(args[0]) if err != nil { fmt.Printf("Address Error %s", err)