diff --git a/testing/endpoint.go b/testing/endpoint.go index 7044e5ed349..376680f2d8a 100644 --- a/testing/endpoint.go +++ b/testing/endpoint.go @@ -626,6 +626,30 @@ func (endpoint *Endpoint) ChanUpgradeTry() error { return endpoint.Chain.sendMsgs(msg) } +// ChanUpgradeAck sends a MsgChannelUpgradeAck to the associated endpoint. +func (endpoint *Endpoint) ChanUpgradeAck() error { + err := endpoint.UpdateClient() + require.NoError(endpoint.Chain.TB, err) + + proofChannel, proofUpgrade, height := endpoint.QueryChannelUpgradeProof() + + counterpartyUpgrade, found := endpoint.Counterparty.Chain.App.GetIBCKeeper().ChannelKeeper.GetUpgrade(endpoint.Counterparty.Chain.GetContext(), endpoint.Counterparty.ChannelConfig.PortID, endpoint.Counterparty.ChannelID) + require.True(endpoint.Chain.TB, found) + + msg := channeltypes.NewMsgChannelUpgradeAck( + endpoint.ChannelConfig.PortID, + endpoint.ChannelID, + endpoint.Counterparty.GetChannel().FlushStatus, + counterpartyUpgrade, + proofChannel, + proofUpgrade, + height, + endpoint.Chain.SenderAccount.GetAddress().String(), + ) + + return endpoint.Chain.sendMsgs(msg) +} + // SetChannelState sets a channel state func (endpoint *Endpoint) SetChannelState(state channeltypes.State) error { channel := endpoint.GetChannel()