fix(bump): climb single-subtree compound BUMP to block root (#167)#168
Merged
galt-tr merged 1 commit intoMay 26, 2026
Merged
Conversation
…kchain#167) A single-subtree block whose coinbase sits outside the subtree has a block tree taller than the subtree STUMP. BuildCompoundBUMP's single-subtree path returned the subtree root instead of the block root, so ValidateCompoundRoot rejected the compound and the block's tracked txs stayed at SEEN_MULTIPLE_NODES instead of reaching MINED. Fold the subtree root up to the block root using the coinbase BUMP's left-spine siblings. No-op when the coinbase BUMP is not taller than the STUMP, so power-of-two single-subtree blocks are unaffected. Reproduced with real inputs from mainnet block 950675 (39,657 txs).
👋 Thanks, @rafa-js!This pull request comes from a fork. For security, our CI runs in a restricted mode.
Thanks for contributing to bsv-blockchain/arcade! 🚀 |
Contributor
|
Thank you, good catch. I am surprised we didn't catch this before; I see many single subtree blocks on TTN where this isn't the case. Wondering if theres something unique about how teranode stores blocks from a legacy sv node? regardless, I can confirm this is a real bug. |
galt-tr
approved these changes
May 26, 2026
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.
What Changed
BuildCompoundBUMP's single-subtree path now folds the subtree root up to the true block-header merkle root using the coinbase BUMP's left-spine siblings (newextendSubtreeToBlockRoothelper inbump/bump.go).bump/issue167_test.go) plus the real captured inputs as fixtures (bump/issue167_fixtures_test.go) from mainnet block 950675.Why It Was Necessary
ValidateCompoundRoottherefore rejected the compound (computede0360bc5…≠ header32d293e3…), no BUMP was persisted, and the block's tracked transactions were stuck atSEEN_MULTIPLE_NODESand never reachedMINED. The failure is deterministic, so/reprocesscould not recover it.Testing Performed
e0360bc5…≠ header32d293e3…) before the fix and passes after; it also verifies every tracked tx's minimal path computes the canonical block-header merkle root32d293e3….go test ./bump/andgo test ./services/bump_builder/: pass.go build ./...: clean.golangci-lintv2.12.2 (CI-pinned) on./bump/: 0 issues.gofmt: clean.Impact / Risk
bumpsuite still passes). Only previously-failing single-subtree blocks change behaviour — from "rejected, no BUMP" to a valid, header-reconciling compound BUMP.Notifications