Skip to content

fix(dash-spv): dedupe and cap InstantSendLock requests - #1182

Closed
ZocoLini wants to merge 1 commit into
devfrom
fix/spv-islock-requests
Closed

ZocoLini wants to merge 1 commit into
devfrom
fix/spv-islock-requests

Conversation

@ZocoLini

Copy link
Copy Markdown
Collaborator

The InstantSend manager requested every InstantSendLock it saw in an inv, with no record of what it had already asked for, so a peer repeating announcements caused unbounded getdata traffic.

  • Requests are tracked in a DownloadCoordinator<InstantSendLockHash>: a lock already in flight is not requested again (also within one inv).
  • At most MAX_REQUESTED_INSTANTLOCKS (100) are in flight; announcements over the cap are dropped, so nothing queues up.
  • A received lock frees its slot; unanswered requests time out, and a disconnect clears them.

Not covered: the cap is global rather than per peer, and a lock already received can be requested again if announced later (the lock cache is keyed by txid, not by lock hash).

Closes #1123

🤖 Generated with Claude Code

The InstantSend manager kept no record of the InstantSendLocks it had
requested, so every announcement, repeats included, sent a new getdata. It now
tracks them in a `DownloadCoordinator`: a lock already in flight is not
requested again, at most `MAX_REQUESTED_INSTANTLOCKS` are in flight, and a
received or timed-out request frees its slot.

Closes #1123

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 15, 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

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.83%. Comparing base (80298d0) to head (e8132a4).

Files with missing lines Patch % Lines
dash-spv/src/sync/instantsend/manager.rs 93.93% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1182      +/-   ##
==========================================
- Coverage   78.87%   78.83%   -0.04%     
==========================================
  Files         304      304              
  Lines       81405    81439      +34     
==========================================
  Hits        64206    64206              
- Misses      17199    17233      +34     
Flag Coverage Δ
core 77.59% <ø> (ø)
ffi 50.80% <ø> (+<0.01%) ⬆️
rpc 52.05% <ø> (ø)
spv 92.65% <94.28%> (-0.14%) ⬇️
wallet 82.19% <ø> (ø)
Files with missing lines Coverage Δ
dash-spv/src/sync/instantsend/sync_manager.rs 100.00% <100.00%> (ø)
dash-spv/src/sync/instantsend/manager.rs 93.66% <93.93%> (+0.02%) ⬆️

... and 8 files with indirect coverage changes

@ZocoLini

Copy link
Copy Markdown
Collaborator Author

Closing: the network refactor in #902 will take this over, see #1123.

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.

dash-spv: dedupe and cap InstantSendLock inv requests

1 participant