Bugfix gov votes querier to use votes params (#7589)

* bugfix gov votes querier to use votes params

* move partially used statement to the proper block

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
yys 2020-10-21 02:35:44 +09:00 committed by GitHub
parent 24e156bf62
commit 1542ecb18d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}
@ -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)
}