-
Notifications
You must be signed in to change notification settings - Fork 992
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
Send list of peers before dropping a peer #2725
Conversation
It turns out that we first accept and the randomly drop connections if we have excess of peers. This PR adds logging and sending the current list of peers to a peer to be disconnected. It should improve peer discovery.
This looks good, but we're still going to change it to only drop the most recent incoming connections, right? |
Does this open us up to new network mapping attacks? |
@JeremyRubin In what way? Nodes can always request a peer list. The only thing peers are learning from this is that the node is connected to too many peers. |
@JeremyRubin as David said of you are connected to a peer you can request a peer list. Here we prevent bootstrap problem. |
Pls let me paste the related part here from #2726 (comment)
|
Handshake actually happens even if we exceed number of peers, clean up happens periodically after that, so no need to embellish handshake. In this pr we don't wait for a peer list request, but unconditionally send the list before dropping the connection. |
Just thinking out loud - does this open us up to any kind of DoS attack? Scenario - I drown a node in a large number of connection attempts, each one forcing the node to hit its db and build a large message payload. Maybe we prevent this via our "recent attempts" tracking (at least for the case where these repeated attempts come from the same ip address)? |
@antiochp we read once per clean cycle from db no matter how many peers we have, it's not related to connection attempt. To be on the same page - we accept all handshakes and after that we may remove excess of peers doing periodical checks. So we are more like Google Play, not like AppStore. I'm not sure we should accept handshake if we have too many peers, perhaps we should have |
As I said in #2725 (comment), I'm proposing to enhance the hand/shake, if the peer need the peer list, it can indicate in And we should duplicate the excessing logic on the connection request part, instead of current accept / drop / accept / drop / ... |
@garyyu Adding a field to the hand message would require a protocol bump, which would cause all kinds of havoc on the network, or it requires abusing the capabilities field. I personally don't believe sending a few dozen addresses to a peer is a big deal. They're only 18 bytes each. |
What if we send the list only to peers connected in last n seconds? We have this info now. |
I think the proper fix for this is running actual seeds instead of full nodes. That would allow any node to get enough addresses to bootstrap (which seems to be the goal here). So perhaps @quentinlesceller https://github.com/mimblewimble/seeder should get some love. |
It seems I found the reason of peer dropping, closing in favor of #2780 |
It turns out that we first accept and then randomly drop connections if we have an excess of peers. This PR adds logging and sending the current list of peers to a peer to be disconnected. It should improve peer discovery.