Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't pass height to RPC calls #4307

Merged
merged 3 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .pending/bugfixes/sdk/4307-https-github-co
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 2 additions & 6 deletions client/rpc/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
7 changes: 1 addition & 6 deletions client/rpc/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}