Skip to content

Commit 0d890fd

Browse files
authored
fix(gossipsub): fix mesh/fanout inconsistencies
When a peer unsubscribes also remove it from fanout. Pull-Request: #5690.
1 parent c9c44b1 commit 0d890fd

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

protocols/gossipsub/CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
## 0.48.0
22

3+
- Correct state inconsistencies with the mesh and fanout when unsubscribing.
4+
See [PR 5690](https://github.com/libp2p/rust-libp2p/pull/5690)
5+
36
- Deprecate `futures-ticker` and use `futures-timer` instead.
47
See [PR 5674](https://github.com/libp2p/rust-libp2p/pull/5674).
8+
59
- Apply `max_transmit_size` to the inner message instead of the final payload.
610
See [PR 5642](https://github.com/libp2p/rust-libp2p/pull/5642).
711

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

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

protocols/gossipsub/src/behaviour.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,8 +1962,11 @@ where
19621962
}
19631963
}
19641964

1965-
// remove unsubscribed peers from the mesh if it exists
1965+
// remove unsubscribed peers from the mesh and fanout if they exist there.
19661966
for (peer_id, topic_hash) in unsubscribed_peers {
1967+
self.fanout
1968+
.get_mut(&topic_hash)
1969+
.map(|peers| peers.remove(&peer_id));
19671970
self.remove_peer_from_mesh(&peer_id, &topic_hash, None, false, Churn::Unsub);
19681971
}
19691972

0 commit comments

Comments
 (0)