Limit context background (#8093)

* limit context background

* update

* fixed minor issues

* fixed TestStatusCommand

* Fix keyring import from older versions. (#8436)

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: sahith-narahari <sahithnarahari@gmail.com>

* Add changelog (#8490)

* fix: tendermint subcommands should not create missing files (#8481)

If the user specifies an incorrect `--home`, then the old behaviour
would automatically populate it with fresh values, but we should
fail instead.

* limit context background

* update

* fixed minor issues

* fixed TestStatusCommand

* statik.go

* replaced static.go

Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: sahith-narahari <sahithnarahari@gmail.com>
Co-authored-by: Michael FIG <mfig@agoric.com>
This commit is contained in:
Andrei Ivasko
2021-02-03 09:47:25 +00:00
committed by GitHub
co-authored by Jonathan Gimeno Alessio Treglia sahith-narahari Michael FIG
parent ce161c4f0c
commit d37c590e90
21 changed files with 96 additions and 107 deletions
+5 -5
View File
@@ -50,7 +50,7 @@ func ValidatorCommand() *cobra.Command {
page, _ := cmd.Flags().GetInt(flags.FlagPage)
limit, _ := cmd.Flags().GetInt(flags.FlagLimit)
result, err := GetValidators(clientCtx, height, &page, &limit)
result, err := GetValidators(cmd.Context(), clientCtx, height, &page, &limit)
if err != nil {
return err
}
@@ -117,14 +117,14 @@ func validatorOutput(validator *tmtypes.Validator) (ValidatorOutput, error) {
}
// GetValidators from client
func GetValidators(clientCtx client.Context, height *int64, page, limit *int) (ResultValidatorsOutput, error) {
func GetValidators(ctx context.Context, clientCtx client.Context, height *int64, page, limit *int) (ResultValidatorsOutput, error) {
// get the node
node, err := clientCtx.GetNode()
if err != nil {
return ResultValidatorsOutput{}, err
}
validatorsRes, err := node.Validators(context.Background(), height, page, limit)
validatorsRes, err := node.Validators(ctx, height, page, limit)
if err != nil {
return ResultValidatorsOutput{}, err
}
@@ -172,7 +172,7 @@ func ValidatorSetRequestHandlerFn(clientCtx client.Context) http.HandlerFunc {
return
}
output, err := GetValidators(clientCtx, &height, &page, &limit)
output, err := GetValidators(r.Context(), clientCtx, &height, &page, &limit)
if rest.CheckInternalServerError(w, err) {
return
}
@@ -189,7 +189,7 @@ func LatestValidatorSetRequestHandlerFn(clientCtx client.Context) http.HandlerFu
return
}
output, err := GetValidators(clientCtx, nil, &page, &limit)
output, err := GetValidators(r.Context(), clientCtx, nil, &page, &limit)
if rest.CheckInternalServerError(w, err) {
return
}