INNER CODE UNIT · Rust

is_validator_registered

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

        fn is_validator_registered(who: &T::AccountId) -> DispatchResult {
            let validator_key = T::ValidatorIdOf::convert(who.clone())
                .ok_or(Error::<T>::NoAssociatedValidatorId)?;
            ensure!(
                T::ValidatorRegistration::is_registered(&validator_key),
                Error::<T>::ValidatorNotRegistered
            );

            Ok(())
        }

        /// Removes a candidate if they exist. Start deposit un-bonding
        fn try_remove_candidate(who: &T::AccountId) -> Result<usize, DispatchError> {
            let current_count =
                <Candidates<T>>::try_mutate(|candidates| -> Result<usize, DispatchError> {
                    let index = candidates
                        .iter()
                        .position(|candidate| candidate.who == *who)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…