Repository navigation
feat(dash-spv): opt-in mempool relay while filters still sync - #1512
PastaPastaPasta wants to merge 1 commit into
Conversation
The mempool manager turns on relay (`filterload`/`filterclear` and `mempool`) only on `FiltersSyncComplete`, so peers announce no transaction or InstantSend lock until the filter scan reaches the tip. A payment to a fresh wallet, InstantSend-locked within seconds, reaches the wallet only minutes later, when sync ends. `ClientConfig::mempool_during_sync` (off by default, so nothing changes for existing users) activates each peer as it connects instead. InstantSend locks that arrive before the masternode list can verify them wait in the InstantSend manager as before. Before filter sync completes the wallet may not know every address and coin it owns, so a payment to an address the scan derives later, or a spend of a coin it has not found yet, is judged irrelevant, and peers never announce it again. When filter sync first completes and the wallet watches something it did not when the mempool was first requested, the manager forgets the txids it found irrelevant and asks every activated peer for its mempool again, reloading the bloom filter first under `BloomFilter`. Until then the bloom filter is not reloaded on every change the scan makes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
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. |
|
Pre-review record for head An independent automated code review read three versions. The last full read was Fixed before this head:
Left as is, listed under trade-offs in the description:
🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1512 +/- ##
==========================================
+ Coverage 87.53% 87.58% +0.04%
==========================================
Files 270 270
Lines 71309 71537 +228
==========================================
+ Hits 62421 62653 +232
+ Misses 8888 8884 -4
|
|
This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them. |
The mempool manager turns on relay (
filterload/filterclearandmempool) only onFiltersSyncComplete, so peers announce no transaction or InstantSend lock until the filter scan reaches the tip. A payment to a fresh wallet that is InstantSend-locked within seconds reaches the wallet only minutes later, when sync ends.ClientConfig::mempool_during_syncturns relay on for each peer as it connects instead. It is off by default, so nothing changes for existing users. InstantSend locks that arrive before the masternode list can verify them wait in the InstantSend manager as before.Before filter sync completes, the wallet may not know every address and coin it owns. A payment to an address the scan derives later, or a spend of a coin it hasn't found yet, is judged irrelevant, and peers never announce it again. So when filter sync first completes and the wallet's monitored set has changed, the manager forgets the txids it judged irrelevant and asks every activated peer for its mempool again, reloading the bloom filter first under
BloomFilter. If no peer is connected at that point, the txids are still forgotten, so the next peer's mempool brings them back. Until then the bloom filter isn't reloaded on every change the scan makes.Trade-offs of turning it on:
BloomFilter, peers get a filter of the addresses known at connect, and the filter is reloaded at completion. A peer that sees both filters can intersect them, which weakens their false-positive cover.dev, a lock dropped from that full queue stays cached and a re-announcement of it is ignored, so its transaction shows unlocked until it confirms. fix(dash-spv): defer unverified InstantLocks #1336 stops caching unverified locks.Tests: unit tests in
sync_manager.rscover the default (no activation before completion), activation on connect and on reconnect during sync, the re-request after completion, forgetting txids with and without connected peers, no re-request when the wallet is unchanged, and the bloom filter not reloading before completion. Four of them fail with the completion refresh removed.test_mempool_during_sync_detects_a_payment_before_sync_completesruns against dashd on the 40,000-block chain under both strategies. It pays a fresh wallet's first address before the client starts and checks that each client detects the payment before it reports synced; with the option off, it fails. It passed in repeated fulldashd_syncruns.cargo fmt --all --check,contrib/run_clippy.py,cargo docwith-D warnings, and the CIspvgroup pass.🤖 Generated with Claude Code