Skip to content

Conversation

jxs
Copy link
Member

@jxs jxs commented Aug 6, 2025

to follow the spec.
This should be merged after the spec PR is merged.

@jxs jxs force-pushed the gossipsub-1.3-extensions branch from 6d0fffc to a4eaf43 Compare August 7, 2025 09:48
Comment on lines 3203 to 3213
let receiver = connected_peer.sender.new_receiver();

if connected_peer.connections.len() <= 1 {
// If this is the first connection send extensions message.
self.send_message(
peer_id,
RpcOut::Extensions(Extensions {
test_extension: Some(true),
}),
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to do this here.

This will send an extension message to all peers that connect to us, even those that don't support extensions. So I think we'd be sending invalid messages to peers on the network that don't support extensions.

Once we create a handler its first message back to us should be the kind of peer that this peer is. We should use this entry point for this code I think, this way it will still be the first message we send (need to make sure it goes before subscriptions) and then we can make sure we send it to only peers that support it.

This is the same for inbound connections.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, makes sense I was confused by the spec stating one should sent it as the first message, but we can still do it after checking the PeerKind. Found a clever way to do it aha, ptal age

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants