fn inner_set_keys(
        who: &T::ValidatorId,
        keys: T::Keys,
    ) -> Result<Option<T::Keys>, DispatchError> {
        let old_keys = Self::load_keys(who);
        for id in T::Keys::key_ids() {
            let key = keys.get_raw(*id);
            {
                if !Self::key_owner(*id, key).map_or(true, |owner| &owner == who) {
                    {
                        return Err(Error::<T>::DuplicatedKey.into());
                    };
                }
            };
        }
        for id in T::Keys::key_ids() {
            let key = keys.get_raw(*id);
            if let Some(old) = old_keys.as_ref().map(|k| k.get_raw(*id)) {
                if key == old {
                    continue;
                }
                Self::clear_key_owner(*id, old);
            }
            Self::put_key_owner(*id, key, who);
        }
        Self::put_keys(who, &keys);
        Ok(old_keys)
    }
/// Perform the set_key operation, checking for duplicates. Does not set `Changed`.
///
/// The old keys for this validator are returned, or `None` if there were none.
///
/// This does not ensure that the reference counter in system is incremented appropriately, it
/// must be done by the caller or the keys will be leaked in storage.
Perform the set_key operation, checking for duplicates. Does not set `Changed`.
The old keys for this validator are returned, or `None` if there were none.

This does not ensure that the reference counter in system is incremented appropriately, it
must be done by the caller or the keys will be leaked in storage.
Perform the set_key operation checking for duplicates . Does not set ` Changed ` . The old keys for this validator are returned or ` None ` if there were none . This does not ensure that the reference counter in system is incremented appropriately it must be done by the caller or the keys will be leaked in storage .
fn inner_set_keys(
        who: &T::ValidatorId,
        keys: T::Keys,
    ) -> Result<Option<T::Keys>, DispatchError> {
        let old_keys = Self::load_keys(who);
        for id in T::Keys::key_ids() {
            let key = keys.get_raw(*id);
            {
                if !Self::key_owner(*id, key).map_or(true, |owner| &owner == who) {
                    {
                        return Err(Error::<T>::DuplicatedKey.into());
                    };
                }
            };
        }
        for id in T::Keys::key_ids() {
            let key = keys.get_raw(*id);
            if let Some(old) = old_keys.as_ref().map(|k| k.get_raw(*id)) {
                if key == old {
                    continue;
                }
                Self::clear_key_owner(*id, old);
            }
            Self::put_key_owner(*id, key, who);
        }
        Self::put_keys(who, &keys);
        Ok(old_keys)
    }
fn inner_set_keys ( who : & T :: ValidatorId , keys : T :: Keys , ) -> Result < Option < T :: Keys > , DispatchError > { let old_keys = Self :: load_keys ( who ) ; for id in T :: Keys :: key_ids ( ) { let key = keys . get_raw ( * id ) ; { if ! Self :: key_owner ( * id , key ) . map_or ( true , | owner | & owner == who ) { { return Err ( Error :: < T > :: DuplicatedKey . into ( ) ) ; } ; } } ; } for id in T :: Keys :: key_ids ( ) { let key = keys . get_raw ( * id ) ; if let Some ( old ) = old_keys . as_ref ( ) . map ( | k | k . get_raw ( * id ) ) { if key == old { continue ; } Self :: clear_key_owner ( * id , old ) ; } Self :: put_key_owner ( * id , key , who ) ; } Self :: put_keys ( who , & keys ) ; Ok ( old_keys ) }
Perform the set_key operation, checking for duplicates.
Perform the set_key operation checking for duplicates .
who
&T::ValidatorId
keys
T::Keys
who
&T::ValidatorId
keys
T::Keys