-
Notifications
You must be signed in to change notification settings - Fork 861
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
Define behaviour of admin_addPeer regarding PeerTable #560
Comments
On one side, the admin_addPeer function allows to connect to the peer using RLPx protocol through a P2PNetwork and then adds it to the current maintained peers of this P2PNetwork. On the other side, the PeerTable is maintained by the PeerDiscoveryController. This component is the entrypoint for managing the lifecycle of peers. With the current implementation, a peer added through the admin_addPeer command will not be stored in the PeerTable of the PeerDiscoveryController but only in the P2PNetwork peer list. After looking in geth for how this is implemented, the following process is triggered on the admin_addPeer command :
The current implementation of admin_addPeer allows to add a peer which is only known by the current peer except it's explicitly sent to the PeerDiscoveryController of the same node which is not intuitive. |
@shemnon @lucassaldanha @mbaxter Can we take a decision regarding this issue ? |
Makes sense to me to match the behavior of other clients, but this is probably a question for @timbeiko . Side note - if discovery is explicitly disabled ( |
I agree with @mbaxter. Matching other clients might be the way to go. One thing that we need to consider is that we shouldn't advertise the added peer unless we are actually connected to it. Calling admin_addPeer, adds a peer to a special list, no matter if we actually established the connection or not (it might only be able to connect later on). I believe it doesn't make sense to advertise peers that we haven't connected to. Imagine a scenario in which I call admin_addPeer with the wrong IP. That connection will never be established, but if we advertise it anyway, now we have other peers trying to talk to this wrong IP. |
I think @br0tchain is suggesting that we successfully bond to the peer (discovery ping / pong cycle) before adding it to our peer table, which should ensure that we don't broadcast invalid peers. |
I do, if we match the other clients' behaviour, the peer is added to the discovery table once the client has been able to successfully ping it. |
@br0tchain @mbaxter This sounds very similar to a change I currently have in draft review, #1070. If you look at the 2 line change in |
@davemec - This is related, but a bit different. We're talking about broadcasting peers out to the discovery network when they're added to our node through the |
Thanks @mbaxter |
Our current implementation of admin_addPeer only connects with the peer at wire level (DevP2P) but doesn't add it to the peer table. When we advertise nodes in discovery we advertise peers from our peer table.
If the peer is not added to the peer table, it might never be discovered by other peers in the network.
Done criteria
Investigate how admin_addPeer should behave
Implement the change (if needed)
Raise docs issues if changes are needed
The text was updated successfully, but these errors were encountered: