Skip to content

Commit

Permalink
nit: more
Browse files Browse the repository at this point in the history
  • Loading branch information
seantking committed Jan 17, 2022
1 parent 9664568 commit 07f12bf
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions modules/apps/29-fee/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,17 @@ func NewMsgPayPacketFee(fee Fee, sourcePortId, sourceChannelId, signer string, r
// ValidateBasic performs a basic check of the MsgPayPacketFee fields
func (msg MsgPayPacketFee) ValidateBasic() error {
// validate channelId
err := host.ChannelIdentifierValidator(msg.SourceChannelId)
if err != nil {
if err := host.ChannelIdentifierValidator(msg.SourceChannelId); err != nil {
return err
}

// validate portId
err = host.PortIdentifierValidator(msg.SourcePortId)
if err != nil {
if err := host.PortIdentifierValidator(msg.SourcePortId); err != nil {
return err
}

// signer check
_, err = sdk.AccAddressFromBech32(msg.Signer)
_, err := sdk.AccAddressFromBech32(msg.Signer)
if err != nil {
return sdkerrors.Wrap(err, "failed to convert msg.Signer into sdk.AccAddress")
}
Expand Down Expand Up @@ -117,8 +115,7 @@ func (msg MsgPayPacketFeeAsync) ValidateBasic() error {
return sdkerrors.Wrap(err, "failed to convert msg.Signer into sdk.AccAddress")
}

err = msg.IdentifiedPacketFee.Validate()
if err != nil {
if err = msg.IdentifiedPacketFee.Validate(); err != nil {
return sdkerrors.Wrap(err, "Invalid IdentifiedPacketFee")
}

Expand Down Expand Up @@ -146,12 +143,11 @@ func NewIdentifiedPacketFee(packetId *channeltypes.PacketId, fee Fee, refundAddr

func (fee IdentifiedPacketFee) Validate() error {
// validate PacketId
err := fee.PacketId.Validate()
if err != nil {
if err := fee.PacketId.Validate(); err != nil {
return sdkerrors.Wrap(err, "Invalid PacketId")
}

_, err = sdk.AccAddressFromBech32(fee.RefundAddress)
_, err := sdk.AccAddressFromBech32(fee.RefundAddress)
if err != nil {
return sdkerrors.Wrap(err, "failed to convert RefundAddress into sdk.AccAddress")
}
Expand Down

0 comments on commit 07f12bf

Please sign in to comment.