-
Couldn't load subscription status.
- Fork 1.1k
feat(gossipsub): implement gossipsub 1.3 #6119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
6d0fffc to
a4eaf43
Compare
protocols/gossipsub/src/behaviour.rs
Outdated
| 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), | ||
| }), | ||
| ); | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
26a8b27 to
9cb66d8
Compare
to follow the spec.
This should be merged after the spec PR is merged.