Skip to content

Commit

Permalink
fixing bug with mutating state for comparision
Browse files Browse the repository at this point in the history
  • Loading branch information
damiannolan committed Mar 28, 2023
1 parent 5619334 commit fb9fad0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/core/04-channel/keeper/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func (k Keeper) ChanUpgradeInit(
return 0, "", errorsmod.Wrapf(types.ErrChannelCapabilityNotFound, "caller does not own capability for channel, port ID (%s) channel ID (%s)", portID, channelID)
}

restoreChannel := channel
channel.State = types.INITUPGRADE
if reflect.DeepEqual(channel, proposedUpgradeChannel) {
return 0, "", errorsmod.Wrap(types.ErrChannelExists, "existing channel end is identical to proposed upgrade channel end")
Expand Down Expand Up @@ -66,7 +67,7 @@ func (k Keeper) ChanUpgradeInit(
TimeoutTimestamp: counterpartyTimeoutTimestamp,
}

k.SetUpgradeRestoreChannel(ctx, portID, channelID, channel)
k.SetUpgradeRestoreChannel(ctx, portID, channelID, restoreChannel)
k.SetUpgradeSequence(ctx, portID, channelID, upgradeSequence)
k.SetUpgradeTimeout(ctx, portID, channelID, upgradeTimeout)

Expand Down

0 comments on commit fb9fad0

Please sign in to comment.