peer, server, netsync: fix utreexo proof download - #411
Open
kcalvinalvin wants to merge 6 commits into
Open
kcalvinalvin wants to merge 6 commits into
kcalvinalvin wants to merge 6 commits into
Conversation
MsgGetUtreexoProof had no entry in maybeAddDeadline, so a peer that silently drops a getuproof was only caught by the netsync 3-minute stall window after a flood of orphaned blocks had already piled up. Track CmdUtreexoProof under the standard stallResponseTimeout (30s); the existing default branch in sccReceiveMessage already clears the deadline when the proof arrives.
OnGetData serves InvTypeUtreexoBlock without an IsCurrent check; OnGetUtreexoProof silently drops when not current. A syncing peer ends up with a block and no proof. May be the cause of the observed missing-proof warning, may not -- OnGetUtreexoProof has other silent return paths. The asymmetry is bug-shaped regardless.
kcalvinalvin
force-pushed
the
2026-05-29-fix-utreexo-proof-download
branch
3 times, most recently
from
June 9, 2026 04:14
df14eb5 to
fb46a2e
Compare
A compact state node verifies a block only once both the block and its utreexo proof have arrived, and must connect blocks strictly in chain order. The two messages arrive separately, in any order, and possibly from different peers. Hold both halves in one pending pool keyed by blockhash and connect the child of the tip whenever it is complete, looping as the tip advances. The block and proof intake handlers deposit a half and drive the pool. A half already in the pool is reused when a new sync peer takes over, so only the missing half is re-requested. The pipeline refill keys on outstanding block requests, and a cap bounds the number of full blocks held while their proofs are still in flight.
A block and its proof can come from different peers, so a verification failure cannot always be pinned on one half. Track the sender of each half and route blame accordingly: a consensus rule violation rejects the block to its sender; a proof failure from the same peer that sent the block disconnects that peer; a failure spanning two peers blames neither and re-fetches the pair from the sync peer so the retry is attributable.
clearRequestedState wiped transaction and block requests but left utreexo proof requests in place. When a stalled sync peer is kept rather than disconnected, that state survives, so a dropped proof would never be requested again. Clear it alongside the others.
The stall handler tracked one deadline per message command, so several outstanding getutreexoproof requests shared a single entry and the first response cleared the deadline for the whole batch. Track a deadline per request in a queue and disconnect when the oldest passes, so a silently dropped proof is detected within the stall timeout.
kcalvinalvin
force-pushed
the
2026-05-29-fix-utreexo-proof-download
branch
from
June 9, 2026 06:02
fb46a2e to
ab71b8f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.