Skip to content

Commit

Permalink
modify {Init,Cancel}ChannelUpgrade to just send a msg and not to wait…
Browse files Browse the repository at this point in the history
… for the finality of it

Signed-off-by: Masanori Yoshida <[email protected]>
  • Loading branch information
siburu committed Aug 25, 2024
1 parent e60aae3 commit c5668a8
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions core/channel-upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit c5668a8

Please sign in to comment.