From c5668a88bba4ce1c36a62152852567ebd9f1a543 Mon Sep 17 00:00:00 2001 From: Masanori Yoshida Date: Sun, 25 Aug 2024 15:02:26 +0900 Subject: [PATCH] modify {Init,Cancel}ChannelUpgrade to just send a msg and not to wait for the finality of it Signed-off-by: Masanori Yoshida --- core/channel-upgrade.go | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/core/channel-upgrade.go b/core/channel-upgrade.go index 14cac9ce..6a754df7 100644 --- a/core/channel-upgrade.go +++ b/core/channel-upgrade.go @@ -86,19 +86,9 @@ func InitChannelUpgrade(chain *ProvableChain, upgradeFields chantypes.UpgradeFie msg := chain.Path().ChanUpgradeInit(upgradeFields, addr) - msgIDs, err := chain.SendMsgs([]sdk.Msg{msg}) - if err != nil { + if _, err := chain.SendMsgs([]sdk.Msg{msg}); err != nil { logger.Error("failed to send MsgChannelUpgradeInit", err) return err - } else if len(msgIDs) != 1 { - panic(fmt.Sprintf("len(msgIDs) == %d", len(msgIDs))) - } else if result, err := GetFinalizedMsgResult(*chain, msgIDs[0]); err != nil { - logger.Error("failed to get the finalized result of MsgChannelUpgradeInit", err) - return err - } else if ok, desc := result.Status(); !ok { - err := fmt.Errorf("failed to initialize channel upgrade: %s", desc) - logger.Error(err.Error(), err) - return err } else { logger.Info("successfully initialized channel upgrade") } @@ -207,18 +197,9 @@ func CancelChannelUpgrade(chain, cp *ProvableChain) error { msg := chain.Path().ChanUpgradeCancel(upgErr, addr) - if msgIDs, err := chain.SendMsgs([]sdk.Msg{msg}); err != nil { + if _, err := chain.SendMsgs([]sdk.Msg{msg}); err != nil { logger.Error("failed to send MsgChannelUpgradeCancel", err) return err - } else if len(msgIDs) != 1 { - panic(fmt.Sprintf("len(msgIDs) == %d", len(msgIDs))) - } else if result, err := GetFinalizedMsgResult(*chain, msgIDs[0]); err != nil { - logger.Error("failed to get the finalized result of MsgChannelUpgradeCancel", err) - return err - } else if ok, desc := result.Status(); !ok { - err := fmt.Errorf("failed to cancel the channel upgrade: %s", desc) - logger.Error(err.Error(), err) - return err } else { logger.Info("successfully cancelled the channel upgrade") }