Skip to content
Snippets Groups Projects
Unverified Commit a73ce628 authored by Ankan's avatar Ankan
Browse files

if validator, return exists

parent 6f0f00ab
Branches
No related merge requests found
Pipeline #519178 waiting for manual action with stages
in 1 hour, 35 minutes, and 34 seconds
...@@ -1139,11 +1139,7 @@ pub type Existence = (); ...@@ -1139,11 +1139,7 @@ pub type Existence = ();
pub struct ExistenceOf<T>(core::marker::PhantomData<T>); pub struct ExistenceOf<T>(core::marker::PhantomData<T>);
impl<T: Config> Convert<T::AccountId, Option<Existence>> for ExistenceOf<T> { impl<T: Config> Convert<T::AccountId, Option<Existence>> for ExistenceOf<T> {
fn convert(validator: T::AccountId) -> Option<Existence> { fn convert(validator: T::AccountId) -> Option<Existence> {
ActiveEra::<T>::get() Validators::<T>::contains_key(&validator).then_some(())
.filter(|active_era| {
ErasStakersOverview::<T>::contains_key(active_era.index, &validator)
})
.map(|_| ())
} }
} }
...@@ -1168,11 +1164,7 @@ impl<T: Config> Convert<T::AccountId, Option<ExistenceOrLegacyExposure<T::Accoun ...@@ -1168,11 +1164,7 @@ impl<T: Config> Convert<T::AccountId, Option<ExistenceOrLegacyExposure<T::Accoun
fn convert( fn convert(
validator: T::AccountId, validator: T::AccountId,
) -> Option<ExistenceOrLegacyExposure<T::AccountId, BalanceOf<T>>> { ) -> Option<ExistenceOrLegacyExposure<T::AccountId, BalanceOf<T>>> {
ActiveEra::<T>::get() Validators::<T>::contains_key(&validator).then_some(ExistenceOrLegacyExposure::Exists)
.filter(|active_era| {
ErasStakersOverview::<T>::contains_key(active_era.index, &validator)
})
.map(|_| ExistenceOrLegacyExposure::Exists)
} }
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment