Skip to content

Commit

Permalink
fix(gossipsub): forward to floodsub peers
Browse files Browse the repository at this point in the history
messages weren't forwarded to floodsub peers

Pull-Request: #5908.
  • Loading branch information
turuslan authored Mar 7, 2025
1 parent 29efd0d commit 9caa7f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions protocols/gossipsub/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
- Respect already received IDONTWANT messages when handling IWANT.
See [PR 5901](https://github.com/libp2p/rust-libp2p/pull/5901)

- Fix messages were not forwarded to floodsub peers.
See [PR 5908](https://github.com/libp2p/rust-libp2p/pull/5908)

## 0.48.0

- Allow broadcasting `IDONTWANT` messages when publishing to avoid downloading data that is already available.
Expand Down
12 changes: 7 additions & 5 deletions protocols/gossipsub/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2673,15 +2673,17 @@ where

// Populate the recipient peers mapping

// Add explicit peers
for peer_id in &self.explicit_peers {
let Some(peer) = self.connected_peers.get(peer_id) else {
continue;
};
// Add explicit peers and floodsub peers
for (peer_id, peer) in &self.connected_peers {
if Some(peer_id) != propagation_source
&& !originating_peers.contains(peer_id)
&& Some(peer_id) != message.source.as_ref()
&& peer.topics.contains(&message.topic)
&& (self.explicit_peers.contains(peer_id)
|| (peer.kind == PeerKind::Floodsub
&& !self
.score_below_threshold(peer_id, |ts| ts.publish_threshold)
.0))
{
recipient_peers.insert(*peer_id);
}
Expand Down

0 comments on commit 9caa7f5

Please sign in to comment.