Skip to content

Commit

Permalink
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions cmd/palomad/main.go
Original file line number Diff line number Diff line change
@@ -58,18 +58,20 @@ func main() {

stakingCmd := findCommand(rootCmd, "tx", "staking")

oldStakingPreRun := stakingCmd.PersistentPreRunE

stakingCmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
if len(args) > 0 {
// the process will die if pigeon is not running
app.PigeonMustRun(cmd.Context(), app.PigeonHTTPClient())
}
// all children of tx staking command must check if the pigeon is running
for _, child := range stakingCmd.Commands() {
oldPreRun := child.PreRunE
child.PreRunE = func(cmd *cobra.Command, args []string) error {
if len(args) > 0 {
// the process will die if pigeon is not running
app.PigeonMustRun(cmd.Context(), app.PigeonHTTPClient())
}

if oldStakingPreRun != nil {
return oldStakingPreRun(cmd, args)
if oldPreRun != nil {
return oldPreRun(cmd, args)
}
return nil
}
return nil
}

if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil {

0 comments on commit 33ea0ff

Please sign in to comment.