pub fn new(
        a_client: ForeignClient,
        b_client: ForeignClient,
        delay_period: Duration,
    ) -> Result<Self, ConnectionError> {
        Self::validate_clients(&a_client, &b_client)?;

        // Validate the delay period against the upper bound
        if delay_period > MAX_PACKET_DELAY {
            return Err(ConnectionError::ConstructorFailed(format!(
                "Invalid delay period '{:?}': should be max '{:?}'",
                delay_period, MAX_PACKET_DELAY
            )));
        }

        let mut c = Self {
            delay_period,
            a_side: ConnectionSide::new(
                a_client.dst_chain(),
                a_client.id().clone(),
                Default::default(),
            ),
            b_side: ConnectionSide::new(
                b_client.dst_chain(),
                b_client.id().clone(),
                Default::default(),
            ),
        };

        c.handshake()?;

        Ok(c)
    }
/// Create a new connection, ensuring that the handshake has succeeded and the two connection
/// ends exist on each side.
Create a new connection, ensuring that the handshake has succeeded and the two connection
ends exist on each side.
Create a new connection ensuring that the handshake has succeeded and the two connection ends exist on each side .
pub fn new(
        a_client: ForeignClient,
        b_client: ForeignClient,
        delay_period: Duration,
    ) -> Result<Self, ConnectionError> {
        Self::validate_clients(&a_client, &b_client)?;
        // Validate the delay period against the upper bound
        if delay_period > MAX_PACKET_DELAY {
            return Err(ConnectionError::ConstructorFailed(format!(
                "Invalid delay period '{:?}': should be max '{:?}'",
                delay_period, MAX_PACKET_DELAY
            )));
        }
        let mut c = Self {
            delay_period,
            a_side: ConnectionSide::new(
                a_client.dst_chain(),
                a_client.id().clone(),
                Default::default(),
            ),
            b_side: ConnectionSide::new(
                b_client.dst_chain(),
                b_client.id().clone(),
                Default::default(),
            ),
        };
        c.handshake()?;
        Ok(c)
    }
pub fn new ( a_client : ForeignClient , b_client : ForeignClient , delay_period : Duration , ) -> Result < Self , ConnectionError > { Self :: validate_clients ( & a_client , & b_client ) ? ; // Validate the delay period against the upper bound if delay_period > MAX_PACKET_DELAY { return Err ( ConnectionError :: ConstructorFailed ( format ! ( " " delay_period MAX_PACKET_DELAY ) ) ) ; } let mut c = Self { delay_period , a_side : ConnectionSide :: new ( a_client . dst_chain ( ) , a_client . id ( ) . clone ( ) , Default :: default ( ) , ) , b_side : ConnectionSide :: new ( b_client . dst_chain ( ) , b_client . id ( ) . clone ( ) , Default :: default ( ) , ) , } ; c . handshake ( ) ? ; Ok ( c ) }
Create a new connection, ensuring that the handshake has succeeded and the two connection
ends exist on each side.
Create a new connection ensuring that the handshake has succeeded and the two connection ends exist on each side .
a_client
ForeignClient
b_client
ForeignClient
delay_period
Duration
a_client
ForeignClient
b_client
ForeignClient
delay_period
Duration