Skip to content

Commit

Permalink
chore: amend event emitted for create channel. (#7557)
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim authored Nov 12, 2024
1 parent 0050523 commit d416dc3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions modules/core/04-channel/v2/keeper/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ func EmitWriteAcknowledgementEvents(ctx context.Context, packet types.Packet, ac
// TODO: https://github.com/cosmos/ibc-go/issues/7386
}

// EmitCreateChannelEvent emits a channel create event.
func (*Keeper) EmitCreateChannelEvent(ctx context.Context, channelID string) {
// emitCreateChannelEvent emits a channel create event.
func (*Keeper) emitCreateChannelEvent(ctx context.Context, channelID, clientID string) {
sdkCtx := sdk.UnwrapSDKContext(ctx)

sdkCtx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeCreateChannel,
sdk.NewAttribute(types.AttributeKeyChannelID, channelID),
sdk.NewAttribute(types.AttributeKeyClientID, clientID),
),
sdk.NewEvent(
sdk.EventTypeMessage,
Expand Down
2 changes: 1 addition & 1 deletion modules/core/04-channel/v2/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (k *Keeper) CreateChannel(goCtx context.Context, msg *types.MsgCreateChanne
k.SetCreator(ctx, channelID, msg.Signer)
k.SetNextSequenceSend(ctx, channelID, 1)

k.EmitCreateChannelEvent(goCtx, channelID)
k.emitCreateChannelEvent(goCtx, channelID, msg.ClientId)

return &types.MsgCreateChannelResponse{ChannelId: channelID}, nil
}
Expand Down
1 change: 1 addition & 0 deletions modules/core/04-channel/v2/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
// IBC channel events
const (
AttributeKeyChannelID = "channel_id"
AttributeKeyClientID = "client_id"
)

// IBC channel events vars
Expand Down

0 comments on commit d416dc3

Please sign in to comment.