Skip to content

Commit

Permalink
chore: make AliasV1Channel a private function.
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim committed Nov 12, 2024
1 parent 3abeb0b commit 43584bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions modules/core/04-channel/v2/keeper/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ func (k *Keeper) TimeoutPacketTest(
proofHeight,
)
}

// AliasV1Channel is a wrapper around aliasV1Channel to allow its usage in tests.
func (k *Keeper) AliasV1Channel(ctx context.Context, portID, channelID string) (types.Channel, bool) {
return k.aliasV1Channel(ctx, portID, channelID)
}
6 changes: 3 additions & 3 deletions modules/core/04-channel/v2/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ func (k *Keeper) SetNextSequenceSend(ctx context.Context, channelID string, sequ
}
}

// AliasV1Channel returns a version 2 channel for the given port and channel ID
// aliasV1Channel returns a version 2 channel for the given port and channel ID
// by converting the channel into a version 2 channel.
func (k *Keeper) AliasV1Channel(ctx context.Context, portID, channelID string) (types.Channel, bool) {
func (k *Keeper) aliasV1Channel(ctx context.Context, portID, channelID string) (types.Channel, bool) {
channel, ok := k.channelKeeperV1.GetChannel(ctx, portID, channelID)
if !ok {
return types.Channel{}, false
Expand All @@ -242,7 +242,7 @@ func (k *Keeper) AliasV1Channel(ctx context.Context, portID, channelID string) (
// convertV1Channel attempts to retrieve a v1 channel from the channel keeper if it exists, then converts it
// to a v2 counterparty and stores it in the v2 channel keeper for future use
func (k *Keeper) convertV1Channel(ctx context.Context, port, id string) (types.Channel, bool) {
if channel, ok := k.AliasV1Channel(ctx, port, id); ok {
if channel, ok := k.aliasV1Channel(ctx, port, id); ok {
// we can key on just the channel here since channel ids are globally unique
k.SetChannel(ctx, id, channel)
return channel, true
Expand Down

0 comments on commit 43584bf

Please sign in to comment.