Merge PR #3797: Have MsgCreateValidator.UnmarshalJSON return an error rather than panic.

This commit is contained in:
Samuel E. Moelius 2019-03-04 07:28:18 -05:00 committed by Christopher Goes
parent 05529f9c13
commit c7f6a3e8c6
1 changed files with 5 additions and 1 deletions

View File

@ -107,7 +107,11 @@ func (msg *MsgCreateValidator) UnmarshalJSON(bz []byte) error {
msg.Commission = msgCreateValJSON.Commission
msg.DelegatorAddress = msgCreateValJSON.DelegatorAddress
msg.ValidatorAddress = msgCreateValJSON.ValidatorAddress
msg.PubKey = sdk.MustGetConsPubKeyBech32(msgCreateValJSON.PubKey)
var err error
msg.PubKey, err = sdk.GetConsPubKeyBech32(msgCreateValJSON.PubKey)
if err != nil {
return err
}
msg.Value = msgCreateValJSON.Value
msg.MinSelfDelegation = msgCreateValJSON.MinSelfDelegation