Merge PR #4292: Fix Signing Infos Endpoint

This commit is contained in:
Alexander Bezobchuk
2019-05-09 13:38:15 -04:00
committed by GitHub
parent 85ffce5f58
commit 925070ae38
14 changed files with 184 additions and 162 deletions
+11 -4
View File
@@ -221,9 +221,10 @@ func PostProcessResponse(w http.ResponseWriter, cdc *codec.Codec, response inter
_, _ = w.Write(output)
}
// ParseHTTPArgs parses the request's URL and returns a slice containing all arguments pairs.
// It separates page and limit used for pagination
func ParseHTTPArgs(r *http.Request) (tags []string, page, limit int, err error) {
// ParseHTTPArgsWithLimit parses the request's URL and returns a slice containing
// all arguments pairs. It separates page and limit used for pagination where a
// default limit can be provided.
func ParseHTTPArgsWithLimit(r *http.Request, defaultLimit int) (tags []string, page, limit int, err error) {
tags = make([]string, 0, len(r.Form))
for key, values := range r.Form {
if key == "page" || key == "limit" {
@@ -258,7 +259,7 @@ func ParseHTTPArgs(r *http.Request) (tags []string, page, limit int, err error)
limitStr := r.FormValue("limit")
if limitStr == "" {
limit = DefaultLimit
limit = defaultLimit
} else {
limit, err = strconv.Atoi(limitStr)
if err != nil {
@@ -270,3 +271,9 @@ func ParseHTTPArgs(r *http.Request) (tags []string, page, limit int, err error)
return tags, page, limit, nil
}
// ParseHTTPArgs parses the request's URL and returns a slice containing all
// arguments pairs. It separates page and limit used for pagination.
func ParseHTTPArgs(r *http.Request) (tags []string, page, limit int, err error) {
return ParseHTTPArgsWithLimit(r, DefaultLimit)
}
+3
View File
@@ -119,6 +119,9 @@ type ValidatorSet interface {
// Delegation allows for getting a particular delegation for a given validator
// and delegator outside the scope of the staking module.
Delegation(Context, AccAddress, ValAddress) Delegation
// MaxValidators returns the maximum amount of bonded validators
MaxValidators(Context) uint16
}
//_______________________________________________________________________________