From 11d59323b4937329cf55f05f40d455bf6a557939 Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Tue, 8 Aug 2023 19:39:13 +0300 Subject: [PATCH] Add ChanUpgradeConfirm to endpoint. --- testing/endpoint.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/testing/endpoint.go b/testing/endpoint.go index 684e709b2f5..b5093b115fc 100644 --- a/testing/endpoint.go +++ b/testing/endpoint.go @@ -655,6 +655,30 @@ func (endpoint *Endpoint) ChanUpgradeAck() error { return endpoint.Chain.sendMsgs(msg) } +// ChanUpgradeConfirm sends a MsgChannelUpgradeConfirm to the associated endpoint. +func (endpoint *Endpoint) ChanUpgradeConfirm() 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.NewMsgChannelUpgradeConfirm( + endpoint.ChannelConfig.PortID, + endpoint.ChannelID, + endpoint.Counterparty.GetChannel().State, + counterpartyUpgrade, + proofChannel, + proofUpgrade, + height, + endpoint.Chain.SenderAccount.GetAddress().String(), + ) + + return endpoint.Chain.sendMsgs(msg) +} + // ChanUpgradeOpen sends a MsgChannelUpgradeOpen to the associated endpoint. func (endpoint *Endpoint) ChanUpgradeOpen() error { err := endpoint.UpdateClient()