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 (#2973)

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
(cherry picked from commit a6d251e)

# Conflicts:
#	modules/core/keeper/msg_server.go
  • Loading branch information
damiannolan authored and mergify[bot] committed Jan 18, 2023
1 parent 04bd181 commit e955c9e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions modules/core/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,20 @@ 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")
}

<<<<<<< HEAD
// Write channel into state
k.ChannelKeeper.WriteOpenAckChannel(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyVersion, msg.CounterpartyChannelId)
=======
ctx.Logger().Info("channel open ack callback succeeded", "channel-id", msg.ChannelId, "port-id", msg.PortId)
>>>>>>> a6d251e (chore(statemachine)!: write channel state before invoking app callbacks in ack and confirm channel handshake steps (#2973))

return &channeltypes.MsgChannelOpenAckResponse{}, nil
}
Expand Down Expand Up @@ -300,13 +307,20 @@ 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")
}

<<<<<<< HEAD
// Write channel into state
k.ChannelKeeper.WriteOpenConfirmChannel(ctx, msg.PortId, msg.ChannelId)
=======
ctx.Logger().Info("channel open confirm callback succeeded", "channel-id", msg.ChannelId, "port-id", msg.PortId)
>>>>>>> a6d251e (chore(statemachine)!: write channel state before invoking app callbacks in ack and confirm channel handshake steps (#2973))

return &channeltypes.MsgChannelOpenConfirmResponse{}, nil
}
Expand Down

0 comments on commit e955c9e

Please sign in to comment.