fix: rawlog JSON formatting of proposal_vote option field (#16231)

This commit is contained in:
Andrea Di Michele 2023-05-19 14:41:07 +00:00 committed by GitHub
parent 05cf82474f
commit bda51f2311
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -245,6 +245,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/crypto) [#15258](https://github.com/cosmos/cosmos-sdk/pull/15258) Write keyhash file with permissions 0600 instead of 0555.
* (cli) [#16138](https://github.com/cosmos/cosmos-sdk/pull/16138) Fix snapshot commands panic if snapshot don't exists.
* (types) [#16145](https://github.com/cosmos/cosmos-sdk/pull/16145) Rename interface `ExtensionOptionI` back to `TxExtensionOptionI` to avoid breaking change.
* (x/gov) [#16230](https://github.com/cosmos/cosmos-sdk/pull/16231) Fix: rawlog JSON formatting of proposal_vote option field
### Deprecated

View File

@ -1,6 +1,7 @@
package v1
import (
"encoding/json"
"fmt"
"strings"
@ -92,12 +93,9 @@ func ValidWeightedVoteOption(option WeightedVoteOption) bool {
// WeightedVoteOptions describes array of WeightedVoteOptions
type WeightedVoteOptions []*WeightedVoteOption
func (v WeightedVoteOptions) String() (out string) {
for _, opt := range v {
out += opt.String() + "\n"
}
return strings.TrimSpace(out)
func (v WeightedVoteOptions) String() string {
out, _ := json.Marshal(v)
return string(out)
}
// VoteOptionFromString returns a VoteOption from a string. It returns an error