From 8b68026bb04a469654020a8dcfe68308404e2510 Mon Sep 17 00:00:00 2001 From: Divma <26765164+divagant-martian@users.noreply.github.com> Date: Wed, 3 Nov 2021 18:21:51 -0500 Subject: [PATCH] protocols/gossipsub: Update topic_peers (#2325) Co-authored-by: Max Inden --- protocols/gossipsub/CHANGELOG.md | 3 +++ protocols/gossipsub/src/behaviour.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 8a0b2ca55f4..488d03d1d9f 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -1,8 +1,11 @@ # 0.33.1 [unreleased] +- Fix bug in internal peer's topics tracking (see [PR 2325]). + - Use `instant` and `futures-timer` instead of `wasm-timer` (see [PR 2245]). [PR 2245]: https://github.com/libp2p/rust-libp2p/pull/2245 +[PR 2325]: https://github.com/libp2p/rust-libp2p/pull/2325 # 0.33.0 [2021-11-01] diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index d9682791f20..2798d21ec8f 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -1252,6 +1252,10 @@ where .entry(*peer_id) .or_default() .insert(topic.clone()); + self.topic_peers + .entry(topic.clone()) + .or_default() + .insert(*peer_id); } // we don't GRAFT to/from explicit peers; complain loudly if this happens