-
Notifications
You must be signed in to change notification settings - Fork 7
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
mark potential peer as invalid after a few failed connection attempts #35
Comments
I'm thinking that this info can just be stored in RAM. I think it's OK that it is forgotten if the client is reset. |
Are potential peers currently persisted? |
They are not.
…On Tue, Jan 23, 2024, 23:22 Jan Ferdinand Sauer ***@***.***> wrote:
Are potential peers currently persisted?
—
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACAHF2AP5GREDNNHPOS4FO3YQAZZPAVCNFSM6AAAAAA3LGAHC6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBXGAYTSOBWGA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Then I think it makes perfect sense to also not persist the information described in the OP. |
I was looking into this a little bit. My initial thought is to use the existing sanction/bad_standing mechanism for this. So what if we just add I haven't check deeply into how/when a peer's standing may be improved or reset. Maybe that is not yet implemented? Anyway, I think instead the This ignores whether the peer gets announced again or not. (Do we need to care?) It just uses a simple timeout approach, so basically it looks like:
It seems this would require very little new code. |
This makes a lot of sense to me. You can store a |
closes Neptune-Crypto#35 High Level Changes: * add doc-comments describing how sanctioning system works * Identify PeerStanding by SocketAddr instead of IP because peer's can share IP (not a unique ID) * Add Unsanction (reward) capability * Sanction peer for connect failure * Unsanction peer for connect success * Establish min peer_standing score equal to 0 - cli.peer_tolerance A peer is banned when the min score is reached. * Establish max peer_standing score equal to cli.peer_tolerance * A peer can become banned for ConnectFail but after a 5 minute period is eligible to attempt connect again and becomes unbanned if successful. see: networking_state::CONNECT_FAILED_TIMEOUT_SECS Cleanups/Tweaks: * rename punish_peer to sanction_peer * rename PeerStanding::standing to score * impl strum::Display for PeerSanctionReason * move some existing methods into GlobalState, NetworkingState * wrap db iterator with block_in_place() to make it async-friendly Dependencies: * adds direct dep on thiserror; it already existed in our dep-tree New Tests: * can_track_peer_standing_by_port * ban_peer_connect_fail_and_unban_connect_success
The client keeps track of potential peers by asking the peers it is currently connected to for their peers. Potential peers are kept in memory indefinitely. This leads to repeated failing connection attempts to stale peers.
Track the number of failed connection attempts per peer. If it crosses some threshold, don't attempt to connect to that peer. If the same peer gets announced again and some timeout has passed, reset the number of failed connection attempts and start connection attempts again.
The text was updated successfully, but these errors were encountered: