diff --git a/cmd/tx.go b/cmd/tx.go index cf1a537ae36..da589f6e3fd 100644 --- a/cmd/tx.go +++ b/cmd/tx.go @@ -145,6 +145,11 @@ func upgradeClientsCmd() *cobra.Command { return err } + height, err := cmd.Flags().GetInt64(flags.FlagHeight) + if err != nil { + return err + } + // ensure that keys exist if _, err = c[src].GetAddress(); err != nil { return err @@ -156,13 +161,13 @@ func upgradeClientsCmd() *cobra.Command { targetChainID := args[1] // send the upgrade message on the targetChainID if src == targetChainID { - return c[src].UpgradeClients(c[dst]) + return c[src].UpgradeClients(c[dst], height) } - return c[dst].UpgradeClients(c[src]) + return c[dst].UpgradeClients(c[src], height) }, } - return cmd + return heightFlag(cmd) } func createConnectionCmd() *cobra.Command { diff --git a/relayer/client-tx.go b/relayer/client-tx.go index 632522d2eec..c8b2b999d2b 100644 --- a/relayer/client-tx.go +++ b/relayer/client-tx.go @@ -151,7 +151,7 @@ func (c *Chain) UpdateClients(dst *Chain) (err error) { } // UpgradesClients upgrades the client on src after dst chain has undergone an upgrade. -func (c *Chain) UpgradeClients(dst *Chain) error { +func (c *Chain) UpgradeClients(dst *Chain, height int64) error { sh, err := NewSyncHeaders(c, dst) if err != nil { return err @@ -159,7 +159,10 @@ func (c *Chain) UpgradeClients(dst *Chain) error { if err := sh.Updates(c, dst); err != nil { return err } - height := int64(sh.GetHeight(dst.ChainID)) + + if height == 0 { + height = int64(sh.GetHeight(dst.ChainID)) + } // TODO: construct method of only attempting to get dst header // Note: we explicitly do not check the error since the source