-
Notifications
You must be signed in to change notification settings - Fork 156
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
spv: Implement per-peer increasing backoffs #2466
base: master
Are you sure you want to change the base?
Conversation
I'm going to also add last attempt tracking, so that when we return to a discovered peer at a later point which already had a backoff chosen, we won't wait for the full backoff duration at the point the peer is chosen again, but only the remaining time (if any). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor suggestions
8d278b7
to
2d7ec6d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I use the internet trick to lose all peers, they never come back and sync stops forever with these changes.
Unsure if it's the exact same case you saw, but when I kill my connections while it is in the middle of the rescan, it never errors out of it, and that seems to hang the whole thing. Will take a closer look in the morning. |
Fixed. It wasn't actually hung, just sleeping for a stupidly long timeout. |
During clean shutdown, signal the mixing client to shutdown first, waiting for it to finish running, before closing the RPC and SPV syncers. Updates the mixing module to a version that supports continuing active mixes before terminating the mixing client.
Recreate a new syncer in the SPV reconnect loop in main. This will allow initial sync logic to be reperformed if peers can be connected later. This also adds a forced 5s backoff before peers connection attempts are made again, matching the backoff behavior for RPC syncing.
Backoff for discovered peers begins at 5s and adds an exponentially-decaying increase before maxing out at 90s. Persistent peers use a smaller scaled backoff curve starting at 1s and maxing out at 18s). All backoffs include a small amount of random jitter to avoid reconnection storms at syncer startup. Backoffs are reset if network connection is established to the peer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working well.
Backoff for discovered peers begins at 5s and adds an exponentially-decaying
increase before maxing out at 90s. Persistent peers use a smaller scaled
backoff curve starting at 1s and maxing out at 18s).
All backoffs include a small amount of random jitter to avoid reconnection
storms at syncer startup.
Backoffs are reset if network connection is established to the peer.
Rebased over #2465.