Skip to content

Commit

Permalink
Make sure we have fanout peers when publish (#6738)
Browse files Browse the repository at this point in the history
* Ensure that `fanout_peers` is always non-empty if it's `Some`
  • Loading branch information
ackintosh authored Dec 24, 2024
1 parent 42c64a2 commit 7e0cdde
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions beacon_node/lighthouse_network/gossipsub/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,15 @@ where
// Gossipsub peers
None => {
tracing::debug!(topic=%topic_hash, "Topic not in the mesh");
// `fanout_peers` is always non-empty if it's `Some`.
let fanout_peers = self
.fanout
.get(&topic_hash)
.map(|peers| if peers.is_empty() { None } else { Some(peers) })
.unwrap_or(None);
// If we have fanout peers add them to the map.
if self.fanout.contains_key(&topic_hash) {
for peer in self.fanout.get(&topic_hash).expect("Topic must exist") {
if let Some(peers) = fanout_peers {
for peer in peers {
recipient_peers.insert(*peer);
}
} else {
Expand Down

0 comments on commit 7e0cdde

Please sign in to comment.