Skip to content

Commit

Permalink
Bugfix gov votes querier to use votes params (#7589)
Browse files Browse the repository at this point in the history
* bugfix gov votes querier to use votes params

* move partially used statement to the proper block

Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored and clevinson committed Oct 29, 2020
1 parent 2bc7fa8 commit eab96fe
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions x/gov/client/rest/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,7 @@ func queryVotesOnProposalHandlerFn(clientCtx client.Context) http.HandlerFunc {
return
}

params := types.NewQueryProposalVotesParams(proposalID, page, limit)

bz, err := clientCtx.LegacyAmino.MarshalJSON(params)
bz, err := clientCtx.LegacyAmino.MarshalJSON(types.NewQueryProposalParams(proposalID))
if rest.CheckBadRequestError(w, err) {
return
}
Expand All @@ -356,10 +354,17 @@ func queryVotesOnProposalHandlerFn(clientCtx client.Context) http.HandlerFunc {

// For inactive proposals we must query the txs directly to get the votes
// as they're no longer in state.
params := types.NewQueryProposalVotesParams(proposalID, page, limit)

propStatus := proposal.Status
if !(propStatus == types.StatusVotingPeriod || propStatus == types.StatusDepositPeriod) {
res, err = gcutils.QueryVotesByTxQuery(clientCtx, params)
} else {
bz, err = clientCtx.LegacyAmino.MarshalJSON(params)
if rest.CheckBadRequestError(w, err) {
return
}

res, _, err = clientCtx.QueryWithData("custom/gov/votes", bz)
}

Expand Down

0 comments on commit eab96fe

Please sign in to comment.