pub fn build_conn_try(&self) -> Result<Vec<Any>, ConnectionError> {
        let src_connection = self
            .src_chain()
            .query_connection(self.src_connection_id(), ICSHeight::default())
            .map_err(|e| ConnectionError::QueryError(self.src_chain().id(), e))?;

        // TODO - check that the src connection is consistent with the try options

        // Cross-check the delay_period
        let delay = if src_connection.delay_period() != self.delay_period {
            warn!("`delay_period` for ConnectionEnd @{} is {}s; delay period on local Connection object is set to {}s",
                self.src_chain().id(), src_connection.delay_period().as_secs(), self.delay_period.as_secs());

            warn!(
                "Overriding delay period for local connection object to {}s",
                src_connection.delay_period().as_secs()
            );

            src_connection.delay_period()
        } else {
            self.delay_period
        };

        // Build add send the message(s) for updating client on source
        // TODO - add check if update client is required
        let src_client_target_height = self
            .dst_chain()
            .query_latest_height()
            .map_err(|e| ConnectionError::QueryError(self.dst_chain().id(), e))?;
        let client_msgs = self.build_update_client_on_src(src_client_target_height)?;
        self.src_chain()
            .send_msgs(client_msgs)
            .map_err(|e| ConnectionError::SubmitError(self.src_chain().id(), e))?;

        let query_height = self
            .src_chain()
            .query_latest_height()
            .map_err(|e| ConnectionError::QueryError(self.src_chain().id(), e))?;
        let (client_state, proofs) = self
            .src_chain()
            .build_connection_proofs_and_client_state(
                ConnectionMsgType::OpenTry,
                self.src_connection_id(),
                self.src_client_id(),
                query_height,
            )
            .map_err(|e| {
                ConnectionError::Failed(format!("failed to build connection proofs: {}", e))
            })?;

        // Build message(s) for updating client on destination
        let mut msgs = self.build_update_client_on_dst(proofs.height())?;

        let counterparty_versions = if src_connection.versions().is_empty() {
            self.src_chain()
                .query_compatible_versions()
                .map_err(|e| ConnectionError::QueryError(self.src_chain().id(), e))?
        } else {
            src_connection.versions()
        };

        // Get signer
        let signer = self.dst_chain().get_signer().map_err(|e| {
            ConnectionError::Failed(format!(
                "failed while fetching the signer for dst chain ({}) with error: {}",
                self.dst_chain().id(),
                e
            ))
        })?;

        let prefix = self
            .src_chain()
            .query_commitment_prefix()
            .map_err(|e| ConnectionError::QueryError(self.src_chain().id(), e))?;

        let counterparty = Counterparty::new(
            self.src_client_id().clone(),
            Option::from(self.src_connection_id().clone()),
            prefix,
        );

        let new_msg = MsgConnectionOpenTry {
            client_id: self.dst_client_id().clone(),
            client_state,
            previous_connection_id: None,
            counterparty,
            counterparty_versions,
            proofs,
            delay_period: delay,
            signer,
        };

        msgs.push(new_msg.to_any());
        Ok(msgs)
    }
/// Attempts to build a MsgConnOpenTry.
Attempts to build a MsgConnOpenTry.
Attempts to build a MsgConnOpenTry .
pub fn build_conn_try(&self) -> Result<Vec<Any>, ConnectionError> {
        let src_connection = self
            .src_chain()
            .query_connection(self.src_connection_id(), ICSHeight::default())
            .map_err(|e| ConnectionError::QueryError(self.src_chain().id(), e))?;
        // TODO - check that the src connection is consistent with the try options
        // Cross-check the delay_period
        let delay = if src_connection.delay_period() != self.delay_period {
            warn!("`delay_period` for ConnectionEnd @{} is {}s; delay period on local Connection object is set to {}s",
                self.src_chain().id(), src_connection.delay_period().as_secs(), self.delay_period.as_secs());
            warn!(
                "Overriding delay period for local connection object to {}s",
                src_connection.delay_period().as_secs()
            );
            src_connection.delay_period()
        } else {
            self.delay_period
        };
        // Build add send the message(s) for updating client on source
        // TODO - add check if update client is required
        let src_client_target_height = self
            .dst_chain()
            .query_latest_height()
            .map_err(|e| ConnectionError::QueryError(self.dst_chain().id(), e))?;
        let client_msgs = self.build_update_client_on_src(src_client_target_height)?;
        self.src_chain()
            .send_msgs(client_msgs)
            .map_err(|e| ConnectionError::SubmitError(self.src_chain().id(), e))?;
        let query_height = self
            .src_chain()
            .query_latest_height()
            .map_err(|e| ConnectionError::QueryError(self.src_chain().id(), e))?;
        let (client_state, proofs) = self
            .src_chain()
            .build_connection_proofs_and_client_state(
                ConnectionMsgType::OpenTry,
                self.src_connection_id(),
                self.src_client_id(),
                query_height,
            )
            .map_err(|e| {
                ConnectionError::Failed(format!("failed to build connection proofs: {}", e))
            })?;
        // Build message(s) for updating client on destination
        let mut msgs = self.build_update_client_on_dst(proofs.height())?;
        let counterparty_versions = if src_connection.versions().is_empty() {
            self.src_chain()
                .query_compatible_versions()
                .map_err(|e| ConnectionError::QueryError(self.src_chain().id(), e))?
        } else {
            src_connection.versions()
        };
        // Get signer
        let signer = self.dst_chain().get_signer().map_err(|e| {
            ConnectionError::Failed(format!(
                "failed while fetching the signer for dst chain ({}) with error: {}",
                self.dst_chain().id(),
                e
            ))
        })?;
        let prefix = self
            .src_chain()
            .query_commitment_prefix()
            .map_err(|e| ConnectionError::QueryError(self.src_chain().id(), e))?;
        let counterparty = Counterparty::new(
            self.src_client_id().clone(),
            Option::from(self.src_connection_id().clone()),
            prefix,
        );
        let new_msg = MsgConnectionOpenTry {
            client_id: self.dst_client_id().clone(),
            client_state,
            previous_connection_id: None,
            counterparty,
            counterparty_versions,
            proofs,
            delay_period: delay,
            signer,
        };
        msgs.push(new_msg.to_any());
        Ok(msgs)
    }
pub fn build_conn_try ( & self ) -> Result < Vec < Any > , ConnectionError > { let src_connection = self . src_chain ( ) . query_connection ( self . src_connection_id ( ) , ICSHeight :: default ( ) ) . map_err ( | e | ConnectionError :: QueryError ( self . src_chain ( ) . id ( ) , e ) ) ? ; // TODO - check that the src connection is consistent with the try options // Cross-check the delay_period let delay = if src_connection . delay_period ( ) != self . delay_period { warn ! ( " " self src_chain ( ) id ( ) src_connection delay_period ( ) as_secs ( ) self delay_period as_secs ( ) ) ; warn ! ( " " src_connection delay_period ( ) as_secs ( ) ) ; src_connection . delay_period ( ) } else { self . delay_period } ; // Build add send the message(s) for updating client on source // TODO - add check if update client is required let src_client_target_height = self . dst_chain ( ) . query_latest_height ( ) . map_err ( | e | ConnectionError :: QueryError ( self . dst_chain ( ) . id ( ) , e ) ) ? ; let client_msgs = self . build_update_client_on_src ( src_client_target_height ) ? ; self . src_chain ( ) . send_msgs ( client_msgs ) . map_err ( | e | ConnectionError :: SubmitError ( self . src_chain ( ) . id ( ) , e ) ) ? ; let query_height = self . src_chain ( ) . query_latest_height ( ) . map_err ( | e | ConnectionError :: QueryError ( self . src_chain ( ) . id ( ) , e ) ) ? ; let ( client_state , proofs ) = self . src_chain ( ) . build_connection_proofs_and_client_state ( ConnectionMsgType :: OpenTry , self . src_connection_id ( ) , self . src_client_id ( ) , query_height , ) . map_err ( | e | { ConnectionError :: Failed ( format ! ( " " e ) ) } ) ? ; // Build message(s) for updating client on destination let mut msgs = self . build_update_client_on_dst ( proofs . height ( ) ) ? ; let counterparty_versions = if src_connection . versions ( ) . is_empty ( ) { self . src_chain ( ) . query_compatible_versions ( ) . map_err ( | e | ConnectionError :: QueryError ( self . src_chain ( ) . id ( ) , e ) ) ? } else { src_connection . versions ( ) } ; // Get signer let signer = self . dst_chain ( ) . get_signer ( ) . map_err ( | e | { ConnectionError :: Failed ( format ! ( " " self dst_chain ( ) id ( ) e ) ) } ) ? ; let prefix = self . src_chain ( ) . query_commitment_prefix ( ) . map_err ( | e | ConnectionError :: QueryError ( self . src_chain ( ) . id ( ) , e ) ) ? ; let counterparty = Counterparty :: new ( self . src_client_id ( ) . clone ( ) , Option :: from ( self . src_connection_id ( ) . clone ( ) ) , prefix , ) ; let new_msg = MsgConnectionOpenTry { client_id : self . dst_client_id ( ) . clone ( ) , client_state , previous_connection_id : None , counterparty , counterparty_versions , proofs , delay_period : delay , signer , } ; msgs . push ( new_msg . to_any ( ) ) ; Ok ( msgs ) }
Attempts to build a MsgConnOpenTry.
Attempts to build a MsgConnOpenTry .
&self
&self