mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:44:38 +00:00
cmpctblock: Cache serialized cmpctblock msg for relay [part of prefill series] #36787
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36787
Loading…
Reference in a new issue
No description provided.
Delete branch "2026-11-5-cache-serialized-cmpctblock-msg"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR extends the optimization added in https://github.com/bitcoin/bitcoin/pull/23880 which applies to peers that have requested HB blocks from us to also cache the serialized blocks for low-bandwidth peers. The core change here comes from the closed #26755 made by andrewtoth, but also includes other refactors and type safety improvements.
Performance is less critical for low-bandwidth peers, so this change on its own should have little impact on block propagation, but these refactors are useful as part of https://github.com/bitcoin/bitcoin/pull/35558 which adds prefilling of compact blocks, and where we run the risk of potentially having to serialize more than one cmpctblock_msg (one prefilled and one not-prefilled).
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
🟠 Minor · Thread-launch failure interrupts block acceptance before storage
Under local thread-resource exhaustion, the forced async launch can interrupt acceptance of a new tip-extending block before storage, although a retry can recover.
Location:
src/net_processing.cpp:2253(head).🟠 Minor · Cached getdata replies overwrite header-announcement state
A cached compact-block request can replace the peer's new-branch header state with a stale-branch block, causing an extra inv/getdata round trip when its recorded best-known block does not cover the new branch.
Location:
src/net_processing.cpp:2312(head).🔵 Suggestion · The fallback comment describes an impossible cache-update window
The new SendMessages comment attributes a cache miss to a block connection after vHeaders assembly, but cs_main prevents the cache from changing during that interval.
Location:
src/net_processing.cpp:6269(head).Review coverage was incomplete.
Reviewed:
d84a57a9f78c· Full review report · Previous reportspermalink
for reference, the reason I didn't pick async was that this would create an unnamed/global/unscoped/hidden thread pool. I guess this should be fine, but the commit msg could say that this will introduce a new thread(pool) beside the named threads:
edit: Also ralph says this, while it is likely ai slop, it highlights that this is not a trivial change and reviewers would have to look at the error handling path in this line
nit: While changing the log output, could remove all the fluent/redundant
__func__or reword them to something hard-coded and unique. (Also, drop the trailing newlines, while touching.Concept ACK
Now that we have
ThreadPool, could we instantiate one owned by, say,PeerManager, with a single thread that is then used here instead? That would alleviate the concerns about implicit thread lifecycle handling, and let us explicitly handle errors if we fail to submit the task.Looks like https://github.com/bitcoin/bitcoin/pull/36955/changes replaces this anyway