chore: Better error msgs when node isn't synced (#11449)

* 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>
This commit is contained in:
likhita-809 2022-03-25 19:19:03 +05:30 committed by GitHub
parent b6d2c1ee9a
commit a69764f9f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -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`.

View File

@ -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
}