Skip to content

Commit

Permalink
chore: Better error msgs when node isn't synced (#11449)
Browse files Browse the repository at this point in the history
* better err msg by checking node height

* get node sync info and check for catching up

* small fix

* small fix

* fix test

* add changelog

Co-authored-by: Marko <marbar3778@yahoo.com>
  • Loading branch information
likhita-809 and tac0turtle committed Mar 25, 2022
1 parent b6d2c1e commit a69764f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements

* [\#11449](https://github.com/cosmos/cosmos-sdk/pull/11449) Improved error messages when node isn't synced.
* [\#11349](https://github.com/cosmos/cosmos-sdk/pull/11349) Add `RegisterAminoMsg` function that checks that a msg name is <40 chars (else this would break ledger nano signing) then registers the concrete msg type with amino, it should be used for registering `sdk.Msg`s with amino instead of `cdc.RegisterConcrete`.
* [\#11089](https://github.com/cosmos/cosmos-sdk/pull/11089]) Now cosmos-sdk consumers can upgrade gRPC to its newest versions.
* [\#10439](https://github.com/cosmos/cosmos-sdk/pull/10439) Check error for `RegisterQueryHandlerClient` in all modules `RegisterGRPCGatewayRoutes`.
Expand Down
12 changes: 12 additions & 0 deletions x/auth/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ func GetAccountCmd() *cobra.Command {
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.Account(cmd.Context(), &types.QueryAccountRequest{Address: key.String()})
if err != nil {
node, err2 := clientCtx.GetNode()
if err2 != nil {
return err2
}
status, err2 := node.Status(context.Background())
if err2 != nil {
return err2
}
catchingUp := status.SyncInfo.CatchingUp
if !catchingUp {
return errors.Wrapf(err, "your node may be syncing, please check node status using `/status`")
}
return err
}

Expand Down

0 comments on commit a69764f

Please sign in to comment.