Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion polkadot/node/network/bitfield-distribution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,11 @@ async fn handle_peer_view_change<Context>(
};

let added = peer_data.view.replace_difference(view).cloned().collect::<Vec<_>>();
let current_session_index = state.topologies.get_current_session_index();

let topology = state.topologies.get_current_topology().local_grid_neighbors();
let is_gossip_peer = topology.route_to_peer(RequiredRouting::GridXY, &origin);

let lucky = is_gossip_peer ||
util::gen_ratio_rng(
util::MIN_GOSSIP_PEERS.saturating_sub(topology.len()),
Expand All @@ -809,7 +811,11 @@ async fn handle_peer_view_change<Context>(
let delta_set: Vec<(ValidatorId, BitfieldGossipMessage)> = added
.into_iter()
.filter_map(|new_relay_parent_interest| {
if let Some(job_data) = state.per_relay_parent.get(&new_relay_parent_interest) {
if let Some(job_data) = state
.per_relay_parent
.get(&new_relay_parent_interest)
.filter(|job_data| job_data.signing_context.session_index == current_session_index)
{
// Send all jointly known messages for a validator (given the current relay parent)
// to the peer `origin`...
let one_per_validator = job_data.one_per_validator.clone();
Expand Down
5 changes: 5 additions & 0 deletions polkadot/node/network/protocol/src/grid_topology.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,11 @@ impl SessionBoundGridTopologyStorage {
&self.current_topology.entry
}

/// Returns the current session index.
pub fn get_current_session_index(&self) -> SessionIndex {
self.current_topology.session_index
}

/// Access the current grid topology mutably. Dangerous and intended
/// to be used in tests.
pub fn get_current_topology_mut(&mut self) -> &mut SessionGridTopologyEntry {
Expand Down
Loading