fn update_ancestor_voted_stakes(
        voted_stakes: &mut VotedStakes,
        voted_slot: Slot,
        voted_stake: u64,
        ancestors: &HashMap<Slot, HashSet<Slot>>,
    ) {
        // If there's no ancestors, that means this slot must be from
        // before the current root, so ignore this slot
        let vote_slot_ancestors = ancestors.get(&voted_slot);
        if vote_slot_ancestors.is_none() {
            return;
        }
        let mut slot_with_ancestors = vec![voted_slot];
        slot_with_ancestors.extend(vote_slot_ancestors.unwrap());
        for slot in slot_with_ancestors {
            let current = voted_stakes.entry(slot).or_default();
            *current += voted_stake;
        }
    }
/// Update stake for all the ancestors.
/// Note, stake is the same for all the ancestor.
Update stake for all the ancestors.
Note, stake is the same for all the ancestor.
Update stake for all the ancestors . Note stake is the same for all the ancestor .
fn update_ancestor_voted_stakes(
        voted_stakes: &mut VotedStakes,
        voted_slot: Slot,
        voted_stake: u64,
        ancestors: &HashMap<Slot, HashSet<Slot>>,
    ) {
        // If there's no ancestors, that means this slot must be from
        // before the current root, so ignore this slot
        let vote_slot_ancestors = ancestors.get(&voted_slot);
        if vote_slot_ancestors.is_none() {
            return;
        }
        let mut slot_with_ancestors = vec![voted_slot];
        slot_with_ancestors.extend(vote_slot_ancestors.unwrap());
        for slot in slot_with_ancestors {
            let current = voted_stakes.entry(slot).or_default();
            *current += voted_stake;
        }
    }
fn update_ancestor_voted_stakes ( voted_stakes : & mut VotedStakes , voted_slot : Slot , voted_stake : u64 , ancestors : & HashMap < Slot , HashSet < Slot > > , ) { // If there's no ancestors, that means this slot must be from // before the current root, so ignore this slot let vote_slot_ancestors = ancestors . get ( & voted_slot ) ; if vote_slot_ancestors . is_none ( ) { return ; } let mut slot_with_ancestors = vec ! [ voted_slot ] ; slot_with_ancestors . extend ( vote_slot_ancestors . unwrap ( ) ) ; for slot in slot_with_ancestors { let current = voted_stakes . entry ( slot ) . or_default ( ) ; * current += voted_stake ; } }
Update stake for all the ancestors.
Update stake for all the ancestors .
voted_stakes
&mut VotedStakes
voted_slot
Slot
voted_stake
u64
ancestors
&HashMap<Slot, HashSet<Slot>>
voted_stakes
&mut VotedStakes
voted_slot
Slot
voted_stake
u64
ancestors
&HashMap<Slot, HashSet<Slot>>