Skip to content

Commit

Permalink
better err msg by checking node height
Browse files Browse the repository at this point in the history
  • Loading branch information
likhita-809 committed Mar 24, 2022
1 parent d7ba5d2 commit 418a335
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions x/auth/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
clientrpc "github.com/cosmos/cosmos-sdk/client/rpc"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/query"
Expand Down Expand Up @@ -100,6 +101,13 @@ func GetAccountCmd() *cobra.Command {
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.Account(cmd.Context(), &types.QueryAccountRequest{Address: key.String()})
if err != nil {
height, err2 := clientrpc.GetChainHeight(clientCtx)

This comment has been minimized.

Copy link
@tac0turtle

tac0turtle Mar 24, 2022

Member

this will get the latest height of latest height of the node, so it will be > 0 after the first block is synced.

Doing something like this for catching_up: bool would be better.

height := status.SyncInfo.LatestBlockHeight
return height, nil

if err2 != nil {
return err2
}
if height != 0 {
return errors.Wrapf(err, "your node may be syncing, please check node status using `/status`")
}
return err
}

Expand Down

0 comments on commit 418a335

Please sign in to comment.