Skip to content

Commit

Permalink
Addressing pokt-network#1501 by making set- and get-validator LeanPoc…
Browse files Browse the repository at this point in the history
…ket 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.
  • Loading branch information
iajrz authored and oten91 committed Nov 22, 2022
1 parent 392a0d8 commit 2c33c65
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions app/cmd/cli/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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())
Expand All @@ -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
}

Expand All @@ -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)
Expand Down

0 comments on commit 2c33c65

Please sign in to comment.