Merge PR #4307: Don't pass height to RPC calls
This commit is contained in:
@@ -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.
|
||||
+2
-6
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user