Skip to content

Commit

Permalink
chore(statemachine)!: write channel state before invoking app callbac…
Browse files Browse the repository at this point in the history
…ks in ack and confirm channel handshake steps (cosmos#2973)
  • Loading branch information
mergify[bot] authored and ulbqb committed Jul 31, 2023
1 parent d774bec commit a2aefa4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions modules/core/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,14 @@ func (k Keeper) ChannelOpenAck(goCtx context.Context, msg *channeltypes.MsgChann
return nil, sdkerrors.Wrap(err, "channel handshake open ack failed")
}

// Write channel into state
k.ChannelKeeper.WriteOpenAckChannel(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyVersion, msg.CounterpartyChannelId)

// Perform application logic callback
if err = cbs.OnChanOpenAck(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyChannelId, msg.CounterpartyVersion); err != nil {
return nil, sdkerrors.Wrap(err, "channel open ack callback failed")
}

// Write channel into state
k.ChannelKeeper.WriteOpenAckChannel(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyVersion, msg.CounterpartyChannelId)

return &channeltypes.MsgChannelOpenAckResponse{}, nil
}

Expand All @@ -300,14 +300,14 @@ func (k Keeper) ChannelOpenConfirm(goCtx context.Context, msg *channeltypes.MsgC
return nil, sdkerrors.Wrap(err, "channel handshake open confirm failed")
}

// Write channel into state
k.ChannelKeeper.WriteOpenConfirmChannel(ctx, msg.PortId, msg.ChannelId)

// Perform application logic callback
if err = cbs.OnChanOpenConfirm(ctx, msg.PortId, msg.ChannelId); err != nil {
return nil, sdkerrors.Wrap(err, "channel open confirm callback failed")
}

// Write channel into state
k.ChannelKeeper.WriteOpenConfirmChannel(ctx, msg.PortId, msg.ChannelId)

return &channeltypes.MsgChannelOpenConfirmResponse{}, nil
}

Expand Down

0 comments on commit a2aefa4

Please sign in to comment.