diff --git a/.pending/bugfixes/sdk/4307-https-github-co b/.pending/bugfixes/sdk/4307-https-github-co new file mode 100644 index 000000000000..8cdf73bb1a0c --- /dev/null +++ b/.pending/bugfixes/sdk/4307-https-github-co @@ -0,0 +1,2 @@ +[#4307](https://github.com/cosmos/cosmos-sdk/pull/4307) Don't pass height to RPC calls as +Tendermint will automatically use the latest height. diff --git a/client/rpc/block.go b/client/rpc/block.go index 6d6e0a9fd00e..dcee67b8640f 100644 --- a/client/rpc/block.go +++ b/client/rpc/block.go @@ -137,16 +137,12 @@ func BlockRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { // REST handler to get the latest block func LatestBlockRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - height, err := GetChainHeight(cliCtx) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } - output, err := getBlock(cliCtx, &height) + output, err := getBlock(cliCtx, nil) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return } + rest.PostProcessResponse(w, cdc, output, cliCtx.Indent) } } diff --git a/client/rpc/validators.go b/client/rpc/validators.go index 0c81f8151646..5e2a2b817c41 100644 --- a/client/rpc/validators.go +++ b/client/rpc/validators.go @@ -182,17 +182,12 @@ func ValidatorSetRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { // Latest Validator Set REST handler func LatestValidatorSetRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - height, err := GetChainHeight(cliCtx) + output, err := GetValidators(cliCtx, nil) if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return } - output, err := GetValidators(cliCtx, &height) - if err != nil { - rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) - return - } rest.PostProcessResponse(w, cdc, output, cliCtx.Indent) } }