Skip to content

fix(dash-spv): rank a stalled peer last when routing - #1375

Draft
xdustinface wants to merge 1 commit into
fix/peer-explorationfrom
fix/stalled-peer-last
Draft

xdustinface wants to merge 1 commit into
fix/peer-explorationfrom
fix/stalled-peer-last

Conversation

@xdustinface

Copy link
Copy Markdown
Collaborator

A peer that stopped delivering kept the rates it had earned, so shortest-queue routing kept picking it. In a mainnet run one peer serving 2 to 3 MB/s stalled with blocks owed, received 51 more block requests within 4 s, and each was hedged after 10 s.

A peer that owes replies and delivers under 8 KB/s for HEDGE_AFTER is now stalled, and routing and hedges pick a stalled peer only when every candidate is stalled. The flag clears with the first tick of real delivery, so a fast peer computing one reply keeps its rank. The serving rate is now sampled whenever the peer serves all it can, not only while it is bound to its cap. This change does not depend on #1374.

Stacked on #1373, and will be retargeted to dev when that one merges.

@coderabbitai

coderabbitai Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.99%. Comparing base (9402114) to head (c54619d).

Additional details and impacted files
@@                   Coverage Diff                    @@
##           fix/peer-exploration    #1375      +/-   ##
========================================================
+ Coverage                 79.99%   85.99%   +6.00%     
========================================================
  Files                        66      268     +202     
  Lines                     27816    71713   +43897     
========================================================
+ Hits                      22251    61671   +39420     
- Misses                     5565    10042    +4477     
Flag Coverage Δ
core 82.80% <ø> (?)
rpc 52.10% <ø> (ø)
spv 94.81% <100.00%> (?)
wallet 83.53% <ø> (ø)
Files with missing lines Coverage Δ
dash-spv/src/network/broker.rs 98.33% <100.00%> (ø)
dash-spv/src/network/manager.rs 95.10% <100.00%> (ø)
dash-spv/src/network/peer.rs 92.30% <100.00%> (ø)

... and 199 files with indirect coverage changes

@github-actions github-actions Bot added the merge-conflict The PR conflicts with the target branch. label Nov 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them.

@xdustinface
xdustinface force-pushed the fix/stalled-peer-last branch from e1ff95c to 36ddbe3 Compare November 10, 2026 06:33
@github-actions github-actions Bot removed the merge-conflict The PR conflicts with the target branch. label Nov 10, 2026
@xdustinface
xdustinface force-pushed the fix/stalled-peer-last branch from 36ddbe3 to 92741dc Compare November 10, 2026 14:27
A peer that stopped delivering kept the rates it had earned, so shortest-queue routing kept picking it. In a mainnet run one peer serving 2 to 3 MB/s stalled with blocks owed, received 51 more block requests within 4 s, and each was hedged after 10 s. Its 30 s serving rate, which routing reads first, was sampled only while the peer was bound, so it stayed near 2.5 MB/s for over a minute.

A peer that owes replies and delivers under 8 KB/s for `HEDGE_AFTER` is now stalled. Routing and hedges pick a stalled peer only when every candidate is stalled. The flag clears with the first tick of real delivery, so a fast peer computing one reply for less than `HEDGE_AFTER` keeps its rank, and one computing longer is passed over only until the reply streams in. The serving rate is now sampled whenever the peer serves all it can, as its served rate is, not only while bound.
@xdustinface

Copy link
Copy Markdown
Collaborator Author

Follow-up from the #1345 review: a culprit that StallJudge spares while it waits for its paced kick still gets new requests from route and hedge. Headers and filters routed to it wait until the kick, up to a timeout per culprit ahead of it. When this rebases onto #1345, skip those peers or rank them last here too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant