mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-19 21:04:41 +00:00
Make sure we have fanout peers when publish (#6738)
* Ensure that `fanout_peers` is always non-empty if it's `Some`
This commit is contained in:
@@ -679,9 +679,15 @@ where
|
|||||||
// Gossipsub peers
|
// Gossipsub peers
|
||||||
None => {
|
None => {
|
||||||
tracing::debug!(topic=%topic_hash, "Topic not in the mesh");
|
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 we have fanout peers add them to the map.
|
||||||
if self.fanout.contains_key(&topic_hash) {
|
if let Some(peers) = fanout_peers {
|
||||||
for peer in self.fanout.get(&topic_hash).expect("Topic must exist") {
|
for peer in peers {
|
||||||
recipient_peers.insert(*peer);
|
recipient_peers.insert(*peer);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user