mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:47:36 +00:00
WIP: net: introduce block tracker to retry to download blocks after failure #35113
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!35113
Loading…
Reference in a new issue
No description provided.
Delete branch "block-dl"
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?
Revival of closed/stale #27837 . The change is taken (as of
b18c72cfcd) and rebased to current master. Original description follows.Coming from #27652, part of #29183.
The general idea is to keep track of the user requested blocks so, in
case of a bad behaving peer or a network disconnection, they can be
fetched from another one automatically without any further user interaction.
This was requested by users because the
getblockfrompeerRPC commandlacks the functionality to notify them about block request failures or peer
disconnections (which is expected due to the asynchronous nature of the block
requests).
Currently, this new functionality is limited to blocks requested by the
user via the 'getblockfrompeer' RPC command.
In the future, this class could expand its scope and be utilized in the
regular chain synchronization process. Or, even could be employed in
special procedures like a prune node rescan that uses BIP158 block filters,
or even into BIP157 itself.
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.
A summary of reviews will appear here.
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.
...or fix it to work without retry
Booleans should ideally not be positional parameters, named only (eg, with an options Object)
Sounds like that's a default of true (not RPCArg::Optional::OMITTED with a description noting it)?
The last commit re-introduces behavior "what we had before". I will see how changes could be reordered to avoid removing some behavior and then re-introducing again.
@luke-jr , thanks for the comments on the RPC parameters, I will consider them with upcoming changes.
🐙 This pull request conflicts with the target branch and needs rebase.
⌛ There hasn't been much activity lately and the patch still needs rebase. What is the status here?
Closing for now, due to lack of focus, limited personal resources. Could be marked "Up for grabs"!
Closing for now, due to lack of focus, limited personal resources. Could be marked "Up for grabs"!
Base:
f655a8df755330911c6c109c8b1d04ef5dd4ea09Head:
2034c609f3111a874f6d10122e2fbe602bdf1dd9Findings
Major
A mutated response can leave a request permanently tracked (src/net_processing.cpp:1744, head)
For a peerless request, the tracker records the peer assigned to download the block. If that peer returns a mutated block, the BLOCK handler removes its in-flight request and returns without calling
untrack_requestoruntrack. BecauseRemoveBlockRequesterases the entry fromvBlocksInFlight, the addedFinalizeNodecleanup cannot reach it. The tracker remains assigned to the failed peer, does not retry, and rejects another peerlessgetblockfrompeercall as already tracked.Pending selection can request witness blocks from peers that cannot serve them (src/net_processing.cpp:1428, head)
For a SegWit-active requested block, this branch accepts a non-limited peer based only on height and does not check
CanServeWitnesses. The send path omitsMSG_WITNESS_FLAGfor that peer, while the ordinary block scan rejects blocks active under SegWit when the peer cannot serve witnesses. A compliant stripped response then fails the witness-mutation check and is treated as misbehavior. Apply the equivalent deployment-aware witness-capability check before POP.Minor
A pending block can be selected twice for one peer (src/net_processing.cpp:1429, head)
If capacity remains and a requested missing side-branch block is also eligible in the peer's ordinary sync scan, POP appends it to
vBlockswithout marking it inmapBlocksInFlight.FindNextBlockstherefore does not see it as in flight and can append the same index again.SendMessagesadds each entry tovGetDatabefore callingBlockRequested, so it sends a duplicate GETDATA even though the secondBlockRequestedreturns false. This requires the on-demand request to overlap ordinary sync; no concrete production workflow producing that overlap was identified.Suggestions
Remove the unreachable duplicate-peer check (src/block_request_tracker.cpp:19, head)
A successful
emplacecreates a new defaultBlockRequestwith an emptyin_flightvector. If the block was already present,trackhas already returned at line 14. Therefore,Contains(req.in_flight, *peer_id)can never be true. Remove this unreachable branch and clarify the documented return conditions so the method does not suggest that it can add or check a peer for an already-tracked block.Review coverage was incomplete.
Review limitations
Full review report