revert: skip subtree_data fetch when local txs available (#598)#647
Merged
freemans13 merged 1 commit intoMar 30, 2026
Merged
Conversation
…ockchain#598)" This reverts commit 88379d4.
Contributor
|
🤖 Claude Code Review Status: Complete Review Summary: This PR is a clean revert of #598, which introduced a flawed Findings: ✅ No issues found - This is a clean revert with correct implementation:
Notes:
This revert is safe to merge. |
icellan
approved these changes
Mar 30, 2026
|
Contributor
Benchmark Comparison ReportBaseline: Current: Summary
All benchmark results (sec/op)
Threshold: >10% with p < 0.05 | Generated: 2026-03-30 17:28 UTC |
freemans13
added a commit
to freemans13/teranode
that referenced
this pull request
Mar 30, 2026
Re-add blockAssemblyClient to subtreevalidation Server after PR bsv-blockchain#647 revert removed it. Wire it up in daemon and fix test callers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
galt-tr
pushed a commit
to galt-tr/teranode
that referenced
this pull request
Apr 1, 2026
freemans13
added a commit
to freemans13/teranode
that referenced
this pull request
Apr 17, 2026
…SM cascade Forces FSM into CATCHINGBLOCKS while a fresh ReceivedAt stamp exists and asserts the liveness gate still skips subtreeData. This is the test that, had it existed, would have prevented PR bsv-blockchain#598 from being reverted (PR bsv-blockchain#647). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Apr 17, 2026
6 tasks
freemans13
added a commit
to freemans13/teranode
that referenced
this pull request
Jun 5, 2026
…ockchain#745 review Pin the adaptive-fetch gate pessimistic until the node first reaches FSM RUNNING, so cold-start IBD / restart-while-behind never skips subtreeData at the moment txs are least likely to be local. New() now always starts pessimistic; a one-way, idempotent Arm() latch (tripped by each service on the first RUNNING) applies the configured bootstrap mode and clears the pre-arm window so fake-perfect IBD samples can't cause an instant flip. The latch never re-locks, so a post-RUNNING catch-up burst may still use optimistic mode. pkg/adaptivefetch stays FSM-free: Arm is a generic trigger and the FSM wait (WaitForFSMtoTransitionToGivenState RUNNING) lives in the service layer, so TestNoWallClockOrFSMDependency still holds and the bsv-blockchain#598/bsv-blockchain#647 clock/FSM-gating class-of-bug is not reintroduced into the algorithm. Also addresses the review: - Add TestCheckBlockSubtrees_Optimistic_SkipsFetchSubtreeData covering the previously-untested optimistic skip branch in subtreevalidation (runs both modes so it cannot pass trivially). - Extract (*State).RecordSyntheticWarmup, collapsing the two duplicated ~34-line observation-recording blocks (SonarQube duplication). - Log the previously-swallowed fallback adaptivefetch.New error in both blockvalidation and subtreevalidation Server constructors. - Honest docs/TODO for the synthetic MissingFetches=0 one-way limitation; fix "four collectors" -> two comment drift; update settings longdesc to describe the arm-on-RUNNING behaviour. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.



Summary
localTxsAvailableheuristic compared block assembly's total pool count against the block's transaction count — a false positive that skipped downloading subtree data even when specific transactions (e.g. coinbase splitting txs) were missing locallyContext
A replacement with an improved adaptive strategy is in #646. This revert cleans up the broken heuristic so the replacement PR has a clean base.
Test plan
go build ./...passesTestCheckBlockSubtreestests passgit revertof merge commit 88379d4🤖 Generated with Claude Code