INNER CODE UNIT · Rust

assemble_collators

AstarNetwork/Astar · pallets/collator-selection/src/lib.rs:755

        pub fn assemble_collators(candidates: Vec<T::AccountId>) -> Vec<T::AccountId> {
            let mut collators = Invulnerables::<T>::get();
            collators.extend(candidates.into_iter());
            collators
        }
        /// Kicks out and candidates that did not produce a block in the kick threshold.
        /// Return length of candidates before and number of kicked candidates.
        pub fn kick_stale_candidates() -> (u32, u32) {
            let now = frame_system::Pallet::<T>::block_number();
            let kick_threshold = T::KickThreshold::get();
            let count = Candidates::<T>::get().len() as u32;
            for (who, last_authored) in LastAuthoredBlock::<T>::iter() {
                if now.saturating_sub(last_authored) < kick_threshold {
                    continue;
                }
                // stale candidate, kick and slash
                if Self::is_account_candidate(&who) {
                    if Candidates::<T>::get().len() > T::MinCandidates::get() as usize {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…