Merge PR #4932: Fix gov query vote cmd

This commit is contained in:
Alexander Bezobchuk 2019-08-20 12:57:27 -04:00 committed by GitHub
parent 3a4f1fc4d4
commit 1f04826b07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

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

View File

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