pub fn check_allowanse(&mut self, tx: &ChangePubKey) -> Result<(), failure::Error> {
        // First, check if we have to reset all the stats.
        if self.last_reset.elapsed() >= ONE_DAY {
            // One day has passed, reset all the account stats.
            self.last_reset = Instant::now();
            self.account_ops = HashMap::new();
        }

        // Get the operations count for this account and check if it's beyond the limit.
        let account_ops_count = self
            .account_ops
            .entry(tx.account_id)
            .and_modify(|e| *e += 1)
            .or_insert(1);
        if *account_ops_count > MAX_OPS_PER_DAY {
            failure::bail!("Limit for ChangePubKey operations was reached for this account. Try again tomorrow");
        }
        Ok(())
    }
/// Checks whether the provided transaction should be executed or considered spam.
Checks whether the provided transaction should be executed or considered spam.
Checks whether the provided transaction should be executed or considered spam .
pub fn check_allowanse(&mut self, tx: &ChangePubKey) -> Result<(), failure::Error> {
        // First, check if we have to reset all the stats.
        if self.last_reset.elapsed() >= ONE_DAY {
            // One day has passed, reset all the account stats.
            self.last_reset = Instant::now();
            self.account_ops = HashMap::new();
        }
        // Get the operations count for this account and check if it's beyond the limit.
        let account_ops_count = self
            .account_ops
            .entry(tx.account_id)
            .and_modify(|e| *e += 1)
            .or_insert(1);
        if *account_ops_count > MAX_OPS_PER_DAY {
            failure::bail!("Limit for ChangePubKey operations was reached for this account. Try again tomorrow");
        }
        Ok(())
    }
pub fn check_allowanse ( & mut self , tx : & ChangePubKey ) -> Result < ( ) , failure :: Error > { // First, check if we have to reset all the stats. if self . last_reset . elapsed ( ) >= ONE_DAY { // One day has passed, reset all the account stats. self . last_reset = Instant :: now ( ) ; self . account_ops = HashMap :: new ( ) ; } // Get the operations count for this account and check if it's beyond the limit. let account_ops_count = self . account_ops . entry ( tx . account_id ) . and_modify ( | e | * e += 1 ) . or_insert ( 1 ) ; if * account_ops_count > MAX_OPS_PER_DAY { failure :: bail ! ( " " ) ; } Ok ( ( ) ) }
Checks whether the provided transaction should be executed or considered spam.
Checks whether the provided transaction should be executed or considered spam .
&mut self
tx
&ChangePubKey