pub(crate) fn on_new_evidence(
        &mut self,
        evidence: &Evidence<C>,
        state: &State<C>,
    ) -> Vec<Effect<C>> {
        if !ENABLE_ENDORSEMENTS {
            return Vec::new();
        }
        let vidx = evidence.perpetrator();
        state
            .iter_correct_hashes()
            .filter(|&v| {
                let unit = state.unit(v);
                unit.new_hash_obs(state, vidx)
            })
            .map(|v| self.endorse(v))
            .map(|endorsement| Effect::NewVertex(ValidVertex(endorsement)))
            .collect()
    }
/// Returns actions validator needs to take upon receiving a new evidence.
/// Endorses all latest units by honest validators that do not mark new perpetrator as faulty
/// and cite some new message by that validator.
Returns actions validator needs to take upon receiving a new evidence.
Endorses all latest units by honest validators that do not mark new perpetrator as faulty
and cite some new message by that validator.
Returns actions validator needs to take upon receiving a new evidence . Endorses all latest units by honest validators that do not mark new perpetrator as faulty and cite some new message by that validator .
pub(crate) fn on_new_evidence(
        &mut self,
        evidence: &Evidence<C>,
        state: &State<C>,
    ) -> Vec<Effect<C>> {
        if !ENABLE_ENDORSEMENTS {
            return Vec::new();
        }
        let vidx = evidence.perpetrator();
        state
            .iter_correct_hashes()
            .filter(|&v| {
                let unit = state.unit(v);
                unit.new_hash_obs(state, vidx)
            })
            .map(|v| self.endorse(v))
            .map(|endorsement| Effect::NewVertex(ValidVertex(endorsement)))
            .collect()
    }
pub ( crate ) fn on_new_evidence ( & mut self , evidence : & Evidence < C > , state : & State < C > , ) -> Vec < Effect < C > > { if ! ENABLE_ENDORSEMENTS { return Vec :: new ( ) ; } let vidx = evidence . perpetrator ( ) ; state . iter_correct_hashes ( ) . filter ( | & v | { let unit = state . unit ( v ) ; unit . new_hash_obs ( state , vidx ) } ) . map ( | v | self . endorse ( v ) ) . map ( | endorsement | Effect :: NewVertex ( ValidVertex ( endorsement ) ) ) . collect ( ) }
Returns actions validator needs to take upon receiving a new evidence.
Returns actions validator needs to take upon receiving a new evidence .
&mut self
evidence
&Evidence<C>
state
&State<C>
&mut self
evidence
&Evidence<C>
state
&State<C>