/// Checks if the version message is valid
Checks if the version message is valid
Checks if the version message is valid
pub fn validate(&self) -> Result<()> {
        if self.version < MIN_SUPPORTED_PROTOCOL_VERSION {
            let msg = format!("Unsupported protocol version: {}", self.version);
            return Err(Error::BadData(msg));
        }
        let now = secs_since(UNIX_EPOCH) as i64;
        if (self.timestamp - now).abs() > 2 * 60 * 60 {
            let msg = format!("Timestamp too old: {}", self.timestamp);
            return Err(Error::BadData(msg));
        }
        Ok(())
    }
pub fn validate ( & self ) -> Result < ( ) > { if self . version < MIN_SUPPORTED_PROTOCOL_VERSION { let msg = format ! ( " " self version ) ; return Err ( Error :: BadData ( msg ) ) ; } let now = secs_since ( UNIX_EPOCH ) as i64 ; if ( self . timestamp - now ) . abs ( ) > 2 * 60 * 60 { let msg = format ! ( " " self timestamp ) ; return Err ( Error :: BadData ( msg ) ) ; } Ok ( ( ) ) }
Checks if the version message is valid
Checks if the version message is valid
&self