pub(crate) fn validate(
        &self,
        validators: &Validators<C::ValidatorId>,
        our_instance_id: &C::InstanceId,
    ) -> Result<(), VertexError> {
        let Ping {
            creator,
            timestamp,
            instance_id,
            signature,
        } = self;
        if instance_id != our_instance_id {
            return Err(PingError::InstanceId.into());
        }
        let v_id = validators.id(self.creator).ok_or(PingError::Creator)?;
        let hash = Self::hash(*creator, *timestamp, *instance_id);
        if !C::verify_signature(&hash, v_id, signature) {
            return Err(PingError::Signature.into());
        }
        Ok(())
    }
/// Validates the ping and returns an error if it is not signed by the creator.
Validates the ping and returns an error if it is not signed by the creator.
Validates the ping and returns an error if it is not signed by the creator .
pub(crate) fn validate(
        &self,
        validators: &Validators<C::ValidatorId>,
        our_instance_id: &C::InstanceId,
    ) -> Result<(), VertexError> {
        let Ping {
            creator,
            timestamp,
            instance_id,
            signature,
        } = self;
        if instance_id != our_instance_id {
            return Err(PingError::InstanceId.into());
        }
        let v_id = validators.id(self.creator).ok_or(PingError::Creator)?;
        let hash = Self::hash(*creator, *timestamp, *instance_id);
        if !C::verify_signature(&hash, v_id, signature) {
            return Err(PingError::Signature.into());
        }
        Ok(())
    }
pub ( crate ) fn validate ( & self , validators : & Validators < C :: ValidatorId > , our_instance_id : & C :: InstanceId , ) -> Result < ( ) , VertexError > { let Ping { creator , timestamp , instance_id , signature , } = self ; if instance_id != our_instance_id { return Err ( PingError :: InstanceId . into ( ) ) ; } let v_id = validators . id ( self . creator ) . ok_or ( PingError :: Creator ) ? ; let hash = Self :: hash ( * creator , * timestamp , * instance_id ) ; if ! C :: verify_signature ( & hash , v_id , signature ) { return Err ( PingError :: Signature . into ( ) ) ; } Ok ( ( ) ) }
Validates the ping and returns an error if it is not signed by the creator.
Validates the ping and returns an error if it is not signed by the creator .
&self
validators
&Validators<C::ValidatorId>
our_instance_id
&C::InstanceId
&self
validators
&Validators<C::ValidatorId>
our_instance_id
&C::InstanceId