fn update_trusted_state(
        &mut self,
        state: TrustedState<Chain::Commit, Chain::Header>,
    ) -> Result<(), error::Error> {
        if state.last_header().header().validators_hash() != state.validators().hash() {
            fail!(
                error::Kind::LightClient,
                "expected validator's hash {}, but got {}",
                state.last_header().header().validators_hash(),
                state.validators().hash()
            )
        }

        self.trusted_store.add(state.clone())?;

        // TODO: Pruning

        debug!(
            state.header.hash = %state.last_header().header().hash(),
            state.header.height = state.last_header().header().height(),
            "updated trusted store"
        );

        self.last_trusted_state = Some(state);

        Ok(())
    }
/// Update the last trusted state with the given state,
/// and add it to the trusted store.
///
/// This method only verifies that the validators hashes match.
///
/// TODO: Pruning
Update the last trusted state with the given state,
and add it to the trusted store.

This method only verifies that the validators hashes match.

Pruning
Update the last trusted state with the given state and add it to the trusted store . This method only verifies that the validators hashes match . Pruning
fn update_trusted_state(
        &mut self,
        state: TrustedState<Chain::Commit, Chain::Header>,
    ) -> Result<(), error::Error> {
        if state.last_header().header().validators_hash() != state.validators().hash() {
            fail!(
                error::Kind::LightClient,
                "expected validator's hash {}, but got {}",
                state.last_header().header().validators_hash(),
                state.validators().hash()
            )
        }
        self.trusted_store.add(state.clone())?;
        // TODO: Pruning
        debug!(
            state.header.hash = %state.last_header().header().hash(),
            state.header.height = state.last_header().header().height(),
            "updated trusted store"
        );
        self.last_trusted_state = Some(state);
        Ok(())
    }
fn update_trusted_state ( & mut self , state : TrustedState < Chain :: Commit , Chain :: Header > , ) -> Result < ( ) , error :: Error > { if state . last_header ( ) . header ( ) . validators_hash ( ) != state . validators ( ) . hash ( ) { fail ! ( error Kind LightClient " " state last_header ( ) header ( ) validators_hash ( ) state validators ( ) hash ( ) ) } self . trusted_store . add ( state . clone ( ) ) ? ; // TODO: Pruning debug ! ( state header hash state last_header ( ) header ( ) hash ( ) state header height state last_header ( ) header ( ) height ( ) " " ) ; self . last_trusted_state = Some ( state ) ; Ok ( ( ) ) }
Update the last trusted state with the given state,
and add it to the trusted store.
Update the last trusted state with the given state and add it to the trusted store .
&mut self
state
TrustedState<Chain::Commit, Chain::Header>
&mut self
state
TrustedState<Chain::Commit, Chain::Header>