Skip to content

Commit

Permalink
fix: appHash mismatch causes by channelsMap
Browse files Browse the repository at this point in the history
  • Loading branch information
j75689 committed Jan 30, 2024
1 parent dc761f4 commit 46a35eb
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions x/ibc/endblock.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,25 @@ func closeSideChainChannels(ctx sdk.Context, k Keeper) sdk.Events {
govChannelId := sdk.ChannelID(gov.ProposalTypeManageChanPermission)
permissions := k.sideKeeper.GetChannelSendPermissions(ctx, id)
channels := k.sideKeeper.Config().ChannelIDs()
channelsMap := make(map[sdk.ChannelID]sdk.ChannelPermission)
for _, channelId := range channels {
channelsMap[channelId] = permissions[channelId]
}

// mirror, mirrorSync channel was enabled by BEP84(https://github.com/bnb-chain/BEPs/blob/master/BEPs/BEP84.md)
// Those channels were bsc side channels, so they would not be in the bc store.
channelsMap[mirrorChannelID] = sdk.ChannelAllow
channelsMap[mirrorSyncChannelID] = sdk.ChannelAllow
if _, exist := permissions[mirrorChannelID]; !exist {
channels = append(channels, mirrorChannelID)
permissions[mirrorChannelID] = sdk.ChannelAllow
}
if _, exist := permissions[mirrorSyncChannelID]; !exist {
channels = append(channels, mirrorSyncChannelID)
permissions[mirrorSyncChannelID] = sdk.ChannelAllow
}

// close all side chain channels except gov channel
for channelId, permission := range channelsMap {
for _, channelId := range channels {
if channelId == govChannelId {
// skip gov channel
continue
}
if permission == sdk.ChannelForbidden {
if permissions[channelId] == sdk.ChannelForbidden {
// skip forbidden channel
continue
}
Expand Down

0 comments on commit 46a35eb

Please sign in to comment.