Skip to content

Commit

Permalink
use authority index rather than local index
Browse files Browse the repository at this point in the history
  • Loading branch information
rphmeier committed Sep 7, 2023
1 parent 8a82aba commit 35be89f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions polkadot/node/network/statement-distribution/src/vstaging/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,14 @@ impl PerSessionState {
}
}

fn supply_topology(&mut self, topology: &SessionGridTopology) {
fn supply_topology(&mut self, topology: &SessionGridTopology, local_index: Option<ValidatorIndex>) {
// Note: we use the local index rather than the `self.local_validator` as the
// former may be `Some` when the latter is `None`, due to the set of nodes in
// discovery being a superset of the active validators for consensus.
let grid_view = grid::build_session_topology(
self.session_info.validator_groups.iter(),
topology,
self.local_validator,
local_index,
);

self.grid_view = Some(grid_view);
Expand Down Expand Up @@ -368,9 +371,10 @@ pub(crate) async fn handle_network_update<Context>(
NetworkBridgeEvent::NewGossipTopology(topology) => {
let new_session_index = topology.session;
let new_topology = topology.topology;
let local_index = topology.local_index;

if let Some(per_session) = state.per_session.get_mut(&new_session_index) {
per_session.supply_topology(&new_topology);
per_session.supply_topology(&new_topology, local_index);
}

// TODO [https://github.com/paritytech/polkadot/issues/6194]
Expand Down

0 comments on commit 35be89f

Please sign in to comment.