fn sign_timeout(&mut self, timeout: &Timeout) -> Result<Ed25519Signature, Error> {
        debug!("Incoming timeout message for round {}", timeout.round());
        COUNTERS.requested_sign_timeout.inc();

        self.signer()?;
        self.verify_epoch(timeout.epoch())?;

        let preferred_round = self.persistent_storage.preferred_round()?;
        if timeout.round() <= preferred_round {
            return Err(Error::BadTimeoutPreferredRound(
                timeout.round(),
                preferred_round,
            ));
        }

        let last_voted_round = self.persistent_storage.last_voted_round()?;
        if timeout.round() < last_voted_round {
            return Err(Error::BadTimeoutLastVotedRound(
                timeout.round(),
                last_voted_round,
            ));
        }
        if timeout.round() > last_voted_round {
            self.persistent_storage
                .set_last_voted_round(timeout.round())?;
        }

        let validator_signer = self.signer()?;
        let signature = timeout.sign(&validator_signer);
        COUNTERS.sign_timeout.inc();
        debug!("Successfully signed timeout message.");
        Ok(signature)
    }
/// Only sign the timeout if it is greater than or equal to the last_voted_round and ahead of
/// the preferred_round. We may end up signing timeouts for rounds without first signing votes
/// if we have received QCs but not proposals. Always map the last_voted_round to the last
/// signed timeout to prevent equivocation. We can sign the last_voted_round timeout multiple
/// times by requiring that the underlying signing scheme provides deterministic signatures.
Only sign the timeout if it is greater than or equal to the last_voted_round and ahead of
the preferred_round. We may end up signing timeouts for rounds without first signing votes
if we have received QCs but not proposals. Always map the last_voted_round to the last
signed timeout to prevent equivocation. We can sign the last_voted_round timeout multiple
times by requiring that the underlying signing scheme provides deterministic signatures.
Only sign the timeout if it is greater than or equal to the last_voted_round and ahead of the preferred_round . We may end up signing timeouts for rounds without first signing votes if we have received QCs but not proposals . Always map the last_voted_round to the last signed timeout to prevent equivocation . We can sign the last_voted_round timeout multiple times by requiring that the underlying signing scheme provides deterministic signatures .
fn sign_timeout(&mut self, timeout: &Timeout) -> Result<Ed25519Signature, Error> {
        debug!("Incoming timeout message for round {}", timeout.round());
        COUNTERS.requested_sign_timeout.inc();
        self.signer()?;
        self.verify_epoch(timeout.epoch())?;
        let preferred_round = self.persistent_storage.preferred_round()?;
        if timeout.round() <= preferred_round {
            return Err(Error::BadTimeoutPreferredRound(
                timeout.round(),
                preferred_round,
            ));
        }
        let last_voted_round = self.persistent_storage.last_voted_round()?;
        if timeout.round() < last_voted_round {
            return Err(Error::BadTimeoutLastVotedRound(
                timeout.round(),
                last_voted_round,
            ));
        }
        if timeout.round() > last_voted_round {
            self.persistent_storage
                .set_last_voted_round(timeout.round())?;
        }
        let validator_signer = self.signer()?;
        let signature = timeout.sign(&validator_signer);
        COUNTERS.sign_timeout.inc();
        debug!("Successfully signed timeout message.");
        Ok(signature)
    }
fn sign_timeout ( & mut self , timeout : & Timeout ) -> Result < Ed25519Signature , Error > { debug ! ( " " timeout round ( ) ) ; COUNTERS . requested_sign_timeout . inc ( ) ; self . signer ( ) ? ; self . verify_epoch ( timeout . epoch ( ) ) ? ; let preferred_round = self . persistent_storage . preferred_round ( ) ? ; if timeout . round ( ) <= preferred_round { return Err ( Error :: BadTimeoutPreferredRound ( timeout . round ( ) , preferred_round , ) ) ; } let last_voted_round = self . persistent_storage . last_voted_round ( ) ? ; if timeout . round ( ) < last_voted_round { return Err ( Error :: BadTimeoutLastVotedRound ( timeout . round ( ) , last_voted_round , ) ) ; } if timeout . round ( ) > last_voted_round { self . persistent_storage . set_last_voted_round ( timeout . round ( ) ) ? ; } let validator_signer = self . signer ( ) ? ; let signature = timeout . sign ( & validator_signer ) ; COUNTERS . sign_timeout . inc ( ) ; debug ! ( " " ) ; Ok ( signature ) }
Only sign the timeout if it is greater than or equal to the last_voted_round and ahead of
the preferred_round.
Only sign the timeout if it is greater than or equal to the last_voted_round and ahead of the preferred_round .
&mut self
timeout
&Timeout
&mut self
timeout
&Timeout