-
Notifications
You must be signed in to change notification settings - Fork 43
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
hosts table (db) should include only valid entries #305
Comments
@kilrau my recommendation, for now, is not to record in the hosts table only inbound connections. |
Agree with most of it. Summarized, we want to improve the hosts sharing in the following way:
Already in the works: #177
Don't get it 100%, could you rephrase? @offerm I guess you mean don't record inbound connections at all. |
As correctly decribed in @offerm 's https://hackmd.io/s/r1NhWtbrX, "It is very hard to disconnect from nodes. If A connects with B, disconnects with B, connects with C that is connected to B, A will become connected to B again." If we decide to don't add inbound hosts at all, it's fixed. If we decide to try doing it, I'd suggest to either create a new Another thing: |
@moshababo @sangaman @michael1011 @itsbalamurali Please add your opinions! |
I think the proper behavior might be to only connect to peers specified in I think the banned confirmation prompt is a good idea. Or maybe better we can add a flag to the |
Sounds good: add something like
That also sounds good, but that's only client-side filtering part on connection attempt. How about your opinion on these (mark the ones we already have) @moshababo @sangaman @michael1011 :
|
#315 takes care of those 4 bullet points. Unless for the last one, do you mean disconnecting even beyond a server restart? Right now you'd need to ban to do that, but we could introduce a way to stop disconnecting to a certain node but not quite banning them. |
Nice! Also the 'P2P Port reachable' test? Will do some tests in a bit. Disconnect: Yes, I mean disconnecting beyond a restart, given that we might change the logic into continuously connecting to new hosts at runtime, not only on start. It sounds like a separate issue tho. |
OK, yes since it will only add a node to the db on a successful connection with handshake it should required that the port be reachable, otherwise the connection would fail. Disconnect beyond a restart should definitely be a separate issue. I think we could just use the "ban" functionality for that though, but we'll discuss separately. |
It does add inbound connections to the db if the handshake succeeds, it will only attempt to connect to that node in the future if the handshake advertised an external address. |
My thinking was to only add inbound connected peers if that advertised external address actually works (at least once)... I could easily spam the network with tons of advertised external fake addresses which you'll help me relay and the whole network will be busy trying to connect to these. Of course not perfect, but puts the bar higher. |
The same problem would exist if I connect to an outbound peer and he sends me a ton of fake listening addresses, or would you suggest trying each one? Not all of them might work at any given point in time, too. I think we can just maybe set some upper bound on the # of external addresses that can be shared. |
Yep, I was actually thinking about trying each one, but you are right "momentarily unavailable" will be an issue. @sangaman @michael1011 #311 is taking care to delete a host after a week of not being able to successfully connect. So at least we have a limit there and don't try to connect to fakehosts in perpetuity. Closing. |
A valid entry is an entry that can be used by the node and by nodes connected to it to open outbound connections.
record an entry only upon successful connection.
For inbound connection:
a. don't record it in the table at all, or
b. record it in the table only if the connected peer provided it's listen port
(I opt for a. since we can't validate the listen port for an incoming connection.
don't add a record if the host is localhost or 127.0.0.1 or node didn't provide listen port or the peer PubKey is the same as our PubKey (self-connection).
For outbound connection:
don't add a record if the host is localhost or 127.0.0.1 or the peer PubKey is the same as our PubKey (self-connection).
The text was updated successfully, but these errors were encountered: