From b295f560b4892e3c8a0e8ba18a39caf3fc34d26c Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Fri, 22 Nov 2024 16:05:37 +0100 Subject: [PATCH] fix(gossipsub): readd lines accidently removed with jxs#12 --- protocols/gossipsub/src/behaviour.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index d6e4eb9e212..11231f9a789 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -1030,6 +1030,10 @@ where for peer_id in added_peers { // Send a GRAFT control message + tracing::debug!(peer=%peer_id, "JOIN: Sending Graft message to peer"); + if let Some((peer_score, ..)) = &mut self.peer_score { + peer_score.graft(&peer_id, topic_hash.clone()); + } self.send_message( peer_id, RpcOut::Graft(Graft { @@ -1127,7 +1131,11 @@ where } for peer_id in peers { // Send a PRUNE control message - let prune = self.make_prune(topic_hash, &peer_id, self.config.do_px(), true); + tracing::debug!(%peer_id, "LEAVE: Sending PRUNE to peer"); + + let on_unsubscribe = true; + let prune = + self.make_prune(topic_hash, &peer_id, self.config.do_px(), on_unsubscribe); self.send_message(peer_id, RpcOut::Prune(prune)); // If the peer did not previously exist in any mesh, inform the handler @@ -1283,6 +1291,12 @@ where Instant::now() + self.config.iwant_followup_time(), ); } + tracing::trace!( + peer=%peer_id, + "IHAVE: Asking for the following messages from peer: {:?}", + iwant_ids_vec + ); + self.send_message( *peer_id, RpcOut::IWant(IWant {