-
Notifications
You must be signed in to change notification settings - Fork 0
Merge bitcoin/bitcoin#27626: Parallel compact block downloads, take 3 #1220
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
base: backport-0.26-batch-477
Are you sure you want to change the base?
Merge bitcoin/bitcoin#27626: Parallel compact block downloads, take 3 #1220
Conversation
This is a backport of bitcoin#27626 This PR attempts to mitigate a single case, where high bandwidth peers can bail us out of a flakey peer not completing blocks for us. We allow up to 2 additional getblocktxns requests per unique block. This would hopefully allow the chance for an honest high bandwidth peer to hand us the transactions even if the first in flight peer stalls out. Changes: - Convert mapBlocksInFlight from std::map to std::multimap to allow multiple peers to be downloading the same block - Add IsBlockRequestedFromOutbound() to check if block is being fetched from an outbound peer - Update RemoveBlockRequest() to take optional from_peer parameter to selectively remove only that peers request - Add MAX_CMPCTBLOCKS_INFLIGHT_PER_BLOCK = 3 constant - Remove nBlocksInFlight counter, use vBlocksInFlight.size() instead - Add parallel download test in p2p_compactblocks.py Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
WalkthroughThis pull request refactors in-flight block request tracking to support per-peer, per-block state instead of single-peer tracking. It introduces a multimap-based data structure replacing a map, adds BIP152 high-bandwidth tracking fields, introduces new methods for outbound peer queries, and updates compact block workflows accordingly. A new constant limits concurrent CMPCTBLOCK requests per block, and test coverage for parallel peer reconstruction is added. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (5)
🧰 Additional context used📓 Path-based instructions (3)src/**/*.{cpp,h,cc,cxx,hpp}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**⚙️ CodeRabbit configuration file
Files:
test/functional/**/*.py📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (4)📓 Common learnings📚 Learning: 2025-07-31T01:14:55.631ZApplied to files:
📚 Learning: 2025-07-28T20:34:29.061ZApplied to files:
📚 Learning: 2025-07-28T22:03:12.364ZApplied to files:
🧬 Code graph analysis (2)src/net_processing.cpp (1)
test/functional/p2p_compactblocks.py (3)
🪛 Ruff (0.14.7)test/functional/p2p_compactblocks.py798-798: Missing return type annotation for private function (ANN202) 811-811: Logging statement uses f-string (G004) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
🔇 Additional comments (22)
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. Comment |
Summary
Backport of bitcoin#27626 to Dash Core.
This PR attempts to mitigate a single case, where high bandwidth peers can bail us out of a flakey peer not completing blocks for us. We allow up to 2 additional getblocktxns requests per unique block. This would hopefully allow the chance for an honest high bandwidth peer to hand us the transactions even if the first in flight peer stalls out.
Key Changes:
mapBlocksInFlightfromstd::maptostd::multimapto allow multiple peers to be downloading the same blockIsBlockRequestedFromOutbound()to check if block is being fetched from an outbound peerRemoveBlockRequest()to take optionalfrom_peerparameter to selectively remove only that peer's requestMAX_CMPCTBLOCKS_INFLIGHT_PER_BLOCK = 3constantnBlocksInFlightcounter, usevBlocksInFlight.size()insteadp2p_compactblocks.pyValidation:
Bitcoin PR Reference
bitcoin#27626
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.