Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send IDONTWANT on publish to avoid downloading data we already have #6513

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Changes from all commits
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
13 changes: 9 additions & 4 deletions beacon_node/lighthouse_network/gossipsub/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,11 @@ where
return Err(PublishError::AllQueuesFull(recipient_peers.len()));
}

// Broadcast IDONTWANT messages
if raw_message.raw_protobuf_len() > self.config.idontwant_message_size_threshold() {
self.send_idontwant(&raw_message, &msg_id, raw_message.source.as_ref());
}

tracing::debug!(message=%msg_id, "Published message");

if let Some(metrics) = self.metrics.as_mut() {
Expand Down Expand Up @@ -1830,7 +1835,7 @@ where

// Broadcast IDONTWANT messages
if raw_message.raw_protobuf_len() > self.config.idontwant_message_size_threshold() {
self.send_idontwant(&raw_message, &msg_id, propagation_source);
self.send_idontwant(&raw_message, &msg_id, Some(propagation_source));
}

tracing::debug!(
Expand Down Expand Up @@ -2696,7 +2701,7 @@ where
&mut self,
message: &RawMessage,
msg_id: &MessageId,
propagation_source: &PeerId,
propagation_source: Option<&PeerId>,
) {
let Some(mesh_peers) = self.mesh.get(&message.topic) else {
return;
Expand All @@ -2707,8 +2712,8 @@ where
let recipient_peers = mesh_peers
.iter()
.chain(iwant_peers.iter())
.filter(|peer_id| {
*peer_id != propagation_source && Some(*peer_id) != message.source.as_ref()
.filter(|&peer_id| {
Some(peer_id) != propagation_source && Some(peer_id) != message.source.as_ref()
});

for peer_id in recipient_peers {
Expand Down
Loading