Merge PR #4608: More linters - Gosec, staticcheck
This commit is contained in:
+6
-3
@@ -117,13 +117,16 @@ func BlockRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
|
||||
height, err := strconv.ParseInt(vars["height"], 10, 64)
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest,
|
||||
"ERROR: Couldn't parse block height. Assumed format is '/block/{height}'.")
|
||||
"couldn't parse block height. Assumed format is '/block/{height}'.")
|
||||
return
|
||||
}
|
||||
chainHeight, err := GetChainHeight(cliCtx)
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusInternalServerError, "failed to parse chain height")
|
||||
return
|
||||
}
|
||||
if height > chainHeight {
|
||||
rest.WriteErrorResponse(w, http.StatusNotFound,
|
||||
"ERROR: Requested block height is bigger then the chain length.")
|
||||
rest.WriteErrorResponse(w, http.StatusNotFound, "requested block height is bigger then the chain length")
|
||||
return
|
||||
}
|
||||
output, err := getBlock(cliCtx, &height)
|
||||
|
||||
@@ -161,13 +161,17 @@ func ValidatorSetRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
|
||||
|
||||
height, err := strconv.ParseInt(vars["height"], 10, 64)
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, "ERROR: Couldn't parse block height. Assumed format is '/validatorsets/{height}'.")
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, "failed to parse block height; assumed format is '/validatorsets/{height}'")
|
||||
return
|
||||
}
|
||||
|
||||
chainHeight, err := GetChainHeight(cliCtx)
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusInternalServerError, "failed to parse chain height")
|
||||
return
|
||||
}
|
||||
if height > chainHeight {
|
||||
rest.WriteErrorResponse(w, http.StatusNotFound, "ERROR: Requested block height is bigger then the chain length.")
|
||||
rest.WriteErrorResponse(w, http.StatusNotFound, "requested block height is bigger then the chain length")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user