Skip to content

Commit

Permalink
bind height to rest query
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun committed Nov 19, 2019
1 parent c327590 commit 63f1427
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ tools/bin/*
examples/build/*
docs/_build
client/lcd/statik/statik.go
tools-stamp

# Data - ideally these don't exist
examples/basecoin/app/data
Expand Down
Empty file removed tools-stamp
Empty file.
10 changes: 9 additions & 1 deletion x/oracle/client/rest/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func queryExchangeRatesHandlerFunction(cliCtx context.CLIContext) http.HandlerFu
return
}

cliCtx.WithHeight(height)
cliCtx = cliCtx.WithHeight(height)
rest.PostProcessResponse(w, cliCtx, res)
}
}
Expand All @@ -176,6 +176,10 @@ func queryActivesHandlerFunction(cliCtx context.CLIContext) http.HandlerFunc {

func queryVoterPrevotesHandlerFunction(cliCtx context.CLIContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)
if !ok {
return
}

vars := mux.Vars(r)
voter := vars[RestVoter]
Expand Down Expand Up @@ -207,6 +211,10 @@ func queryVoterPrevotesHandlerFunction(cliCtx context.CLIContext) http.HandlerFu

func queryVoterVotesHandlerFunction(cliCtx context.CLIContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)
if !ok {
return
}

vars := mux.Vars(r)
voter := vars[RestVoter]
Expand Down
2 changes: 1 addition & 1 deletion x/oracle/internal/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type GenesisState struct {
ExchangeRates map[string]sdk.Dec `json:"exchange_rates" yaml:"exchange_rates"`
ExchangeRatePrevotes []ExchangeRatePrevote `json:"exchange_rate_prevotes" yaml:"exchange_rate_prevotes"`
ExchangeRateVotes []ExchangeRateVote `json:"exchange_rate_votes" yaml:"exchange_rate_votes"`
MissCounters map[string]int64 `json:"miss_counters" yaml:"miss_counters`
MissCounters map[string]int64 `json:"miss_counters" yaml:"miss_counters"`
}

// NewGenesisState creates a new GenesisState object
Expand Down

0 comments on commit 63f1427

Please sign in to comment.