feat: gov/v1.Proposal convertion to v1beta1.Proposal cleanup (#14401)
This commit is contained in:
@@ -51,16 +51,14 @@ func ConvertToLegacyProposal(proposal v1.Proposal) (v1beta1.Proposal, error) {
|
||||
if len(msgs) != 1 {
|
||||
return v1beta1.Proposal{}, sdkerrors.ErrInvalidType.Wrap("can't convert a gov/v1 Proposal to gov/v1beta1 Proposal when amount of proposal messages is more than one")
|
||||
}
|
||||
for _, msg := range msgs {
|
||||
if legacyMsg, ok := msg.(*v1.MsgExecLegacyContent); ok {
|
||||
// check that the content struct can be unmarshalled
|
||||
_, err := v1.LegacyContentFromMessage(legacyMsg)
|
||||
if err != nil {
|
||||
return v1beta1.Proposal{}, err
|
||||
}
|
||||
legacyProposal.Content = legacyMsg.Content
|
||||
return legacyProposal, nil
|
||||
if legacyMsg, ok := msgs[0].(*v1.MsgExecLegacyContent); ok {
|
||||
// check that the content struct can be unmarshalled
|
||||
_, err := v1.LegacyContentFromMessage(legacyMsg)
|
||||
if err != nil {
|
||||
return v1beta1.Proposal{}, err
|
||||
}
|
||||
legacyProposal.Content = legacyMsg.Content
|
||||
return legacyProposal, nil
|
||||
}
|
||||
// hack to fill up the content with the first message
|
||||
// this is to support clients that have not yet (properly) use gov/v1 endpoints
|
||||
|
||||
Reference in New Issue
Block a user