Skip to content

Commit

Permalink
Merge PR #4932: Fix gov query vote cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbez authored Aug 20, 2019
1 parent 3a4f1fc commit 1f04826
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ that error is that the account doesn't exist.
* (keys) Fix ledger custom coin type support bug
* (simulation) [\#4912](https://github.com/cosmos/cosmos-sdk/issues/4912) Fix SimApp ModuleAccountAddrs to properly return black listed addresses for bank keeper initialization
* (cli) [\#4919](https://github.com/cosmos/cosmos-sdk/pull/4919) Don't crash cli if user doesn't answer y/n confirmation request
* (cli) [\#4927](https://github.com/cosmos/cosmos-sdk/issues/4927) Fix the `q gov vote`
command to handle empty (pruned) votes correctly.

## [v0.36.0] - 2019-08-13

Expand Down
11 changes: 7 additions & 4 deletions x/gov/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,21 +215,24 @@ $ %s query gov vote 1 cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk
}

var vote types.Vote
if err := cdc.UnmarshalJSON(res, &vote); err != nil {
return err
}

// XXX: Allow the decoding to potentially fail as the vote may have been
// pruned from state. If so, decoding will fail and so we need to check the
// Empty() case. Consider updating Vote JSON decoding to not fail when empty.
_ = cdc.UnmarshalJSON(res, &vote)

if vote.Empty() {
res, err = gcutils.QueryVoteByTxQuery(cliCtx, params)
if err != nil {
return err
}

if err := cdc.UnmarshalJSON(res, &vote); err != nil {
return err
}
}

return cliCtx.PrintOutput(vote) //nolint:errcheck
return cliCtx.PrintOutput(vote)
},
}
}
Expand Down

0 comments on commit 1f04826

Please sign in to comment.