pub fn add_vote_pubkey(
        &mut self,
        vote_pubkey: Arc<Pubkey>,
        stake: u64,
        total_stake: u64,
    ) -> (bool, bool) {
        let is_new = !self.voted.contains(&vote_pubkey);
        if is_new {
            self.voted.insert(vote_pubkey);
            let supermajority_stake = (total_stake as f64 * VOTE_THRESHOLD_SIZE) as u64;
            let old_stake = self.stake;
            let new_stake = self.stake + stake;
            self.stake = new_stake;
            (
                old_stake <= supermajority_stake && supermajority_stake < new_stake,
                is_new,
            )
        } else {
            (false, is_new)
        }
    }
// Returns tuple (is_confirmed, is_new) where
// `is_confirmed` is true if the stake that has voted has just crosssed the supermajority
// of stake
// `is_new` is true if the vote has not been seen before
Returns tuple (is_confirmed, is_new) where
`is_confirmed` is true if the stake that has voted has just crosssed the supermajority
of stake
`is_new` is true if the vote has not been seen before
Returns tuple ( is_confirmed is_new ) where ` is_confirmed ` is true if the stake that has voted has just crosssed the supermajority of stake ` is_new ` is true if the vote has not been seen before
pub fn add_vote_pubkey(
        &mut self,
        vote_pubkey: Arc<Pubkey>,
        stake: u64,
        total_stake: u64,
    ) -> (bool, bool) {
        let is_new = !self.voted.contains(&vote_pubkey);
        if is_new {
            self.voted.insert(vote_pubkey);
            let supermajority_stake = (total_stake as f64 * VOTE_THRESHOLD_SIZE) as u64;
            let old_stake = self.stake;
            let new_stake = self.stake + stake;
            self.stake = new_stake;
            (
                old_stake <= supermajority_stake && supermajority_stake < new_stake,
                is_new,
            )
        } else {
            (false, is_new)
        }
    }
pub fn add_vote_pubkey ( & mut self , vote_pubkey : Arc < Pubkey > , stake : u64 , total_stake : u64 , ) -> ( bool , bool ) { let is_new = ! self . voted . contains ( & vote_pubkey ) ; if is_new { self . voted . insert ( vote_pubkey ) ; let supermajority_stake = ( total_stake as f64 * VOTE_THRESHOLD_SIZE ) as u64 ; let old_stake = self . stake ; let new_stake = self . stake + stake ; self . stake = new_stake ; ( old_stake <= supermajority_stake && supermajority_stake < new_stake , is_new , ) } else { ( false , is_new ) } }
Returns tuple (is_confirmed, is_new) where
`is_confirmed` is true if the stake that has voted has just crosssed the supermajority
of stake
`is_new` is true if the vote has not been seen before
Returns tuple ( is_confirmed is_new ) where ` is_confirmed ` is true if the stake that has voted has just crosssed the supermajority of stake ` is_new ` is true if the vote has not been seen before
&mut self
vote_pubkey
Arc<Pubkey>
stake
u64
total_stake
u64