-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(l1): fetch random peer + filter by supported capability (#1536)
**Motivation** When choosing a peer for backend uses (such as syncing) we need to fetch a random peer and guarantee that its has an active connection and that it supports the capability needed **Description** * Store supported capabilities in `PeerData` * Add a way to get a random filtered peer * Update `get_peer` function so that it fetches a random peer and also receives a capability that the selected peer must support **Follow-Up Work & Ideas** We could implement a `PeerManager` that holds a reference to the kademlia table and is in charge of selecting a suitable peer and performing the requests (instead of selecting a peer and calling a request_ method from the backend). This will allow us to further abstract p2p logic from other backend processes & also implement penalizations for peers returning invalid responses <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves #111, Resolves #222 --> Closes #1317 #1318
- Loading branch information
Showing
4 changed files
with
75 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters