Skip to content
Snippets Groups Projects
Commit 5338f0f0 authored by asynchronous rob's avatar asynchronous rob Committed by GitHub
Browse files

tweaks to relevant_authority_ids (#2796)

parent 0794f693
Branches
No related merge requests found
......@@ -240,9 +240,16 @@ pub fn session_index_for_child<T: initializer::Config>() -> SessionIndex {
pub fn relevant_authority_ids<T: initializer::Config + pallet_authority_discovery::Config>() -> Vec<AuthorityDiscoveryId> {
let current_session_index = session_index_for_child::<T>();
let earliest_stored_session = <session_info::Module<T>>::earliest_stored_session();
let mut authority_ids = <pallet_authority_discovery::Module<T>>::next_authorities();
for session_index in earliest_stored_session..=current_session_index {
// Due to `max_validators`, the `SessionInfo` stores only the validators who are actively
// selected to participate in parachain consensus. We'd like all authorities for the current
// and next sessions to be used in authority-discovery. The two sets likely have large overlap.
let mut authority_ids = <pallet_authority_discovery::Module<T>>::current_authorities();
authority_ids.extend(<pallet_authority_discovery::Module<T>>::next_authorities());
// Due to disputes, we'd like to remain connected to authorities of the previous few sessions.
// For this, we don't need anyone other than the validators actively participating in consensus.
for session_index in earliest_stored_session..current_session_index {
let info = <session_info::Module<T>>::session_info(session_index);
if let Some(mut info) = info {
authority_ids.append(&mut info.discovery_keys);
......
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