Rename validators to select_validators

This commit is contained in:
Luke Parker 2023-10-11 17:23:09 -04:00
parent 2401266374
commit f692047b8b
No known key found for this signature in database
2 changed files with 5 additions and 8 deletions

View file

@ -158,17 +158,14 @@ pub mod pallet {
// then we wait until the session ends then get a call to end_session(i) and so on.
impl<T: Config> SessionManager<T::ValidatorId> for Pallet<T> {
fn new_session(_new_index: u32) -> Option<Vec<T::ValidatorId>> {
// Don't call new_session multiple times on genesis
// TODO: Will this cause pallet_session::Pallet::current_index to desync from validator-sets?
if frame_system::Pallet::<T>::block_number() > 1u32.into() {
VsPallet::<T>::new_session();
}
VsPallet::<T>::new_session();
// TODO: Where do we return their stake?
Some(VsPallet::<T>::validators(NetworkId::Serai))
Some(VsPallet::<T>::select_validators(NetworkId::Serai))
}
fn new_session_genesis(_: u32) -> Option<Vec<T::ValidatorId>> {
Some(VsPallet::<T>::validators(NetworkId::Serai))
// TODO: Because we don't call new_session here, we don't emit NewSet { Serai, session: 1 }
Some(VsPallet::<T>::select_validators(NetworkId::Serai))
}
fn end_session(_end_index: u32) {}

View file

@ -418,7 +418,7 @@ pub mod pallet {
}
}
pub fn validators(network: NetworkId) -> Vec<Public> {
pub fn select_validators(network: NetworkId) -> Vec<Public> {
Self::participants(network).into()
}