Repository navigation
fix(dash-spv): rotate the slowest peer of a slow set - #1373
Draft
xdustinface wants to merge 1 commit into
Draft
xdustinface wants to merge 1 commit into
xdustinface wants to merge 1 commit into
Conversation
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 9, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix/peer-diversity #1373 +/- ##
======================================================
+ Coverage 85.93% 85.98% +0.05%
======================================================
Files 268 268
Lines 71266 71619 +353
======================================================
+ Hits 61240 61582 +342
- Misses 10026 10037 +11
|
xdustinface
force-pushed
the
fix/peer-diversity
branch
from
November 10, 2026 06:19
b3d7199 to
6cb6619
Compare
Contributor
|
This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them. |
xdustinface
force-pushed
the
fix/peer-exploration
branch
from
November 10, 2026 06:23
af7ed75 to
30b3af3
Compare
xdustinface
force-pushed
the
fix/peer-diversity
branch
from
November 10, 2026 14:27
6cb6619 to
afca6fe
Compare
xdustinface
force-pushed
the
fix/peer-exploration
branch
from
November 10, 2026 14:27
30b3af3 to
259d131
Compare
When every peer is slow alike and each sits in its own network group, neither `underserving_peer` nor the crowded-group swap fires, so a set can serve at a fraction of a MB/s for many minutes while faster addresses go untried. - While work is queued and the link is not stalled, `repair_round` rotates out the slowest measured peer if it serves below `EXPLORE_FLOOR_BYTES_PER_SEC`. - Rotation, the judgement of a newcomer, the candidate order and the per-address records use the 30 s `serving_rate`, so a peer is judged only once it has been bound for `SERVING_SAMPLE_TICKS`. A fast mainnet peer serves only 40 to 60% of its later rate in its first 15 s and 70 to 100% by 30 s, so a newcomer judged sooner looks slow while it ramps. - `PeerDiscoverer` remembers what each address served on its last connection. Untried addresses come first, then the known ones fastest first, so a fast peer rotated out by mistake is the first known address dialed again. A rotation skips an address that served no faster than the slowest connected peer. Configured peers are never rotated or rated. - `Exploration` paces rotations: the first once every peer is measured, never before the last newcomer is measured. Rotation runs at the fast pace of `EXPLORE_MIN_INTERVAL` only while the slowest peer serves below `EXPLORE_WORSE_FRACTION` (half) of the set's best, and an even set rotates once per `SWAP_COOLDOWN`. Fast and slow peers differ more than tenfold on mainnet and three to tenfold on testnet, while slow peers among themselves vary within about twofold. - A newcomer is a hit only if it serves at least `EXPLORE_HIT_MARGIN` (twice) the rate of the peer it replaced and is no longer clearly worse than the set's best. From the second miss in a row the interval doubles up to `SWAP_COOLDOWN`, a hit makes it fast again, and a back-off ends when the set's best rate halves or doubles. - `repair_round` keeps `want` dials in flight from a queue of up to `CONNECT_CHUNK` candidates, starting the next one whenever a dial fails or stalls past `DIAL_STAGGER`, and ends a swap round once its newcomer is admitted. A rotation that admitted nobody is no miss. - `Ban::MissingServices` becomes `Ban::Unusable`, a ban for the session. It also covers a peer that leaves the set, by a kick, a swap or a disconnect, after holding work for `REQUEST_TIMEOUT` without answering any of it. A handshake that lost its round's race no longer ranks its address ahead of the untried ones. - Each round that rotates no peer out logs why at `debug`, once per change of reason. - The supervisor tests share `swapped_out`, which can also run the real `Supervisor::run` loop with rates that become known while it runs.
xdustinface
force-pushed
the
fix/peer-exploration
branch
from
November 11, 2026 01:21
259d131 to
9402114
Compare
xdustinface
force-pushed
the
fix/peer-diversity
branch
from
November 11, 2026 01:21
afca6fe to
707faf6
Compare
2 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When every peer is slow alike and each sits in its own network group, neither
underserving_peernor the crowded-group swap fires. A set can then serve at a fraction of a MB/s for many minutes while faster addresses go untried.While work is queued and the link is not stalled,
repair_roundnow rotates out the slowest measured peer if it serves belowEXPLORE_FLOOR_BYTES_PER_SEC. Peers are judged by their 30 sserving_rate, so a newcomer is not judged while it ramps up.PeerDiscovererremembers what each address served on its last connection and dials untried addresses first, then known ones fastest first.Explorationpaces the rotations and backs off after repeated misses. Dials are staggered from a candidate queue, andBan::MissingServicesbecomesBan::Unusable, which also covers a peer that held work forREQUEST_TIMEOUTwithout answering any of it.Stacked on #1372, and will be retargeted to
devwhen that one merges.