Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

add protocols to messages#380

Closed
zeroxbt wants to merge 5 commits intolibp2p:masterfrom
zeroxbt:master
Closed

add protocols to messages#380
zeroxbt wants to merge 5 commits intolibp2p:masterfrom
zeroxbt:master

Conversation

@zeroxbt
Copy link
Copy Markdown
Contributor

@zeroxbt zeroxbt commented Oct 7, 2022

After calling getClosestPeers, I was expecting that the protobook would be updated with protocols supported by newly discovered peers, but I noticed that only the addressbook is updated.

@achingbrain
Copy link
Copy Markdown
Member

Supported protocols are normally exchanged by running the identify protocol after dialing a peer, not gathered from DHT query results. They can also change fairly dynamically so may not be valid for very long.

That said this change could be useful, but it really needs to start with a spec change first so other implementations behave in the same way.

Can you please open an issue in the spec repo with the reasoning for discussion.

The protocols field will need to be added to the rpc protobuf.

@achingbrain achingbrain added the status/blocked Unable to be worked further until needs are met label Oct 11, 2022
@zeroxbt
Copy link
Copy Markdown
Contributor Author

zeroxbt commented Oct 12, 2022

Thanks for replying @achingbrain .
For more context, this feature is useful when you need to perform some protocol operation on the closest peers. To achieve this, after calling getClosestPeers, you'd need to filter peers that don't support the protocol before dialing them.
The problem is that with the current implementation it's not always possible to filter newly discovered peers by protocols since they are not added to the protobook on discovery.

@mpetrunic mpetrunic marked this pull request as draft November 8, 2022 16:47
@mpetrunic mpetrunic added need/author-input Needs input from the original author P3 Low: Not priority right now labels Nov 8, 2022
@achingbrain
Copy link
Copy Markdown
Member

Closing because this module is an implementation of a spec, and this feature isn't part of the spec.

To service your use case you can search for close peers, then just use libp2p.dialProtocol - if they support the protocol then all good, if not then handle the failure case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

need/author-input Needs input from the original author P3 Low: Not priority right now status/blocked Unable to be worked further until needs are met

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants