pub fn update_client_event(
        &self,
        consensus_height: Height,
    ) -> Result<Option<UpdateClient>, ForeignClientError> {
        let request = QueryClientEventRequest {
            height: Height::zero(),
            event_id: IbcEventType::UpdateClient,
            client_id: self.id.clone(),
            consensus_height,
        };

        let mut events = vec![];
        for i in 0..MAX_ITER {
            thread::sleep(Duration::from_millis(100));
            let result = self
                .dst_chain
                .query_txs(QueryTxRequest::Client(request.clone()))
                .map_err(|e| {
                    ForeignClientError::Misbehaviour(format!(
                        "failed to query Tx-es for update client event {}",
                        e
                    ))
                });
            match result {
                Err(e) => {
                    error!("query_tx with error {}, retry {}/{}", e, i + 1, MAX_ITER);
                    continue;
                }
                Ok(result) => {
                    events = result;
                }
            }
        }

        if events.is_empty() {
            return Ok(None);
        }

        // It is possible in theory that `query_txs` returns multiple client update events for the
        // same consensus height. This could happen when multiple client updates with same header
        // were submitted to chain. However this is not what it's observed during testing.
        // Regardless, just take the event from the first update.
        let event = events[0].clone();
        let update = downcast!(event.clone() => IbcEvent::UpdateClient).ok_or_else(|| {
            ForeignClientError::Misbehaviour(format!(
                "query Tx-es returned unexpected event {}",
                event.to_json()
            ))
        })?;
        Ok(Some(update))
    }
/// Retrieves the client update event that was emitted when a consensus state at the
/// specified height was created on chain.
/// It is possible that the event cannot be retrieved if the information is not yet available
/// on the full node. To handle this the query is retried a few times.
Retrieves the client update event that was emitted when a consensus state at the
specified height was created on chain.
It is possible that the event cannot be retrieved if the information is not yet available
on the full node. To handle this the query is retried a few times.
Retrieves the client update event that was emitted when a consensus state at the specified height was created on chain . It is possible that the event cannot be retrieved if the information is not yet available on the full node . To handle this the query is retried a few times .
pub fn update_client_event(
        &self,
        consensus_height: Height,
    ) -> Result<Option<UpdateClient>, ForeignClientError> {
        let request = QueryClientEventRequest {
            height: Height::zero(),
            event_id: IbcEventType::UpdateClient,
            client_id: self.id.clone(),
            consensus_height,
        };
        let mut events = vec![];
        for i in 0..MAX_ITER {
            thread::sleep(Duration::from_millis(100));
            let result = self
                .dst_chain
                .query_txs(QueryTxRequest::Client(request.clone()))
                .map_err(|e| {
                    ForeignClientError::Misbehaviour(format!(
                        "failed to query Tx-es for update client event {}",
                        e
                    ))
                });
            match result {
                Err(e) => {
                    error!("query_tx with error {}, retry {}/{}", e, i + 1, MAX_ITER);
                    continue;
                }
                Ok(result) => {
                    events = result;
                }
            }
        }
        if events.is_empty() {
            return Ok(None);
        }
        // It is possible in theory that `query_txs` returns multiple client update events for the
        // same consensus height. This could happen when multiple client updates with same header
        // were submitted to chain. However this is not what it's observed during testing.
        // Regardless, just take the event from the first update.
        let event = events[0].clone();
        let update = downcast!(event.clone() => IbcEvent::UpdateClient).ok_or_else(|| {
            ForeignClientError::Misbehaviour(format!(
                "query Tx-es returned unexpected event {}",
                event.to_json()
            ))
        })?;
        Ok(Some(update))
    }
pub fn update_client_event ( & self , consensus_height : Height , ) -> Result < Option < UpdateClient > , ForeignClientError > { let request = QueryClientEventRequest { height : Height :: zero ( ) , event_id : IbcEventType :: UpdateClient , client_id : self . id . clone ( ) , consensus_height , } ; let mut events = vec ! [ ] ; for i in 0 .. MAX_ITER { thread :: sleep ( Duration :: from_millis ( 100 ) ) ; let result = self . dst_chain . query_txs ( QueryTxRequest :: Client ( request . clone ( ) ) ) . map_err ( | e | { ForeignClientError :: Misbehaviour ( format ! ( " " e ) ) } ) ; match result { Err ( e ) => { error ! ( " " e i 1 MAX_ITER ) ; continue ; } Ok ( result ) => { events = result ; } } } if events . is_empty ( ) { return Ok ( None ) ; } // It is possible in theory that `query_txs` returns multiple client update events for the // same consensus height. This could happen when multiple client updates with same header // were submitted to chain. However this is not what it's observed during testing. // Regardless, just take the event from the first update. let event = events [ 0 ] . clone ( ) ; let update = downcast ! ( event clone ( ) IbcEvent UpdateClient ) . ok_or_else ( | | { ForeignClientError :: Misbehaviour ( format ! ( " " event to_json ( ) ) ) } ) ? ; Ok ( Some ( update ) ) }
Retrieves the client update event that was emitted when a consensus state at the
specified height was created on chain.
Retrieves the client update event that was emitted when a consensus state at the specified height was created on chain .
&self
consensus_height
Height
&self
consensus_height
Height