From 7deb009932e10c290297247f418890a22ae4fca6 Mon Sep 17 00:00:00 2001 From: Edward Kim Date: Sun, 20 Nov 2022 16:24:23 -0500 Subject: [PATCH] Adjusted the code block to keep the legacy disable for sync consensus, added new block for re-enabling of IBCs --- app/app.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 437676d43..9a80ed1e7 100644 --- a/app/app.go +++ b/app/app.go @@ -587,7 +587,7 @@ func (app *TerraApp) Name() string { return app.BaseApp.Name() } // BeginBlocker application updates every begin block func (app *TerraApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { - if ctx.ChainID() == core.ColumbusChainID && ctx.BlockHeight() == core.SwapEnableForkHeight { // Make min spread to one to disable swap + if ctx.ChainID() == core.ColumbusChainID && ctx.BlockHeight() == core.SwapDisableForkHeight { // Make min spread to one to disable swap params := app.MarketKeeper.GetParams(ctx) params.MinStabilitySpread = sdk.OneDec() app.MarketKeeper.SetParams(ctx, params) @@ -604,6 +604,23 @@ func (app *TerraApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) a panic(fmt.Sprintf("%s not found", channelID)) } + channel.State = ibcchanneltypes.CLOSED + app.IBCKeeper.ChannelKeeper.SetChannel(ctx, ibctransfertypes.PortID, channelID, channel) + } + } + if ctx.ChainID() == core.ColumbusChainID && ctx.BlockHeight() == core.SwapEnableForkHeight { // Re-enable IBCs + // Enable IBC Channels + channelIDs := []string{ + "channel-1", // Osmosis + "channel-49", // Crescent + "channel-20", // Juno + } + for _, channelID := range channelIDs { + channel, found := app.IBCKeeper.ChannelKeeper.GetChannel(ctx, ibctransfertypes.PortID, channelID) + if !found { + panic(fmt.Sprintf("%s not found", channelID)) + } + channel.State = ibcchanneltypes.OPEN app.IBCKeeper.ChannelKeeper.SetChannel(ctx, ibctransfertypes.PortID, channelID, channel) }