From 829ce17d060afe45833616a7b23582dff53d06e1 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Thu, 9 May 2019 16:42:25 -0400 Subject: [PATCH] Merge PR #4307: Don't pass height to RPC calls --- .pending/bugfixes/sdk/4307-https-github-co | 2 ++ client/rpc/block.go | 8 ++------ client/rpc/validators.go | 7 +------ 3 files changed, 5 insertions(+), 12 deletions(-) create mode 100644 .pending/bugfixes/sdk/4307-https-github-co diff --git a/.pending/bugfixes/sdk/4307-https-github-co b/.pending/bugfixes/sdk/4307-https-github-co new file mode 100644 index 0000000000..8cdf73bb1a --- /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 6d6e0a9fd0..dcee67b864 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 0c81f81516..5e2a2b817c 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) } }