Skip to content

Commit

Permalink
fix(gossipsub): fix mesh/fanout inconsistencies
Browse files Browse the repository at this point in the history
When a peer unsubscribes also remove it from fanout.

Pull-Request: #5690.
  • Loading branch information
jxs authored Nov 27, 2024
1 parent c9c44b1 commit 0d890fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions protocols/gossipsub/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
## 0.48.0

- Correct state inconsistencies with the mesh and fanout when unsubscribing.
See [PR 5690](https://github.com/libp2p/rust-libp2p/pull/5690)

- Deprecate `futures-ticker` and use `futures-timer` instead.
See [PR 5674](https://github.com/libp2p/rust-libp2p/pull/5674).

- Apply `max_transmit_size` to the inner message instead of the final payload.
See [PR 5642](https://github.com/libp2p/rust-libp2p/pull/5642).

- Deprecate `void` crate.
See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676).

## 0.47.1

- Attempt to publish to at least mesh_n peers when flood publish is disabled.
See [PR 5578](https://github.com/libp2p/rust-libp2p/pull/5578).

Expand Down
5 changes: 4 additions & 1 deletion protocols/gossipsub/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1962,8 +1962,11 @@ where
}
}

// remove unsubscribed peers from the mesh if it exists
// remove unsubscribed peers from the mesh and fanout if they exist there.
for (peer_id, topic_hash) in unsubscribed_peers {
self.fanout
.get_mut(&topic_hash)
.map(|peers| peers.remove(&peer_id));
self.remove_peer_from_mesh(&peer_id, &topic_hash, None, false, Churn::Unsub);
}

Expand Down

0 comments on commit 0d890fd

Please sign in to comment.