Repository navigation
Conversation
…um work Startup gave consensus assume_valid_height with hash none and n_minimum_chain_work 0. Connect skips scripts when height < assume_valid_height && chainwork >= n_minimum_chain_work, so with a floor of 0 any header chain skipped every script below the height. On mainnet the blvm binary seeds height 912683 (Core v30) with no hash; on a zero-config regtest start the library default height 938343 applied to regtest. Add core_assume_valid_for_network with Bitcoin Core v31.1 chainparams (defaultAssumeValid height and hash, nMinimumChainWork) for mainnet, testnet3 and default signet. Testnet4 keeps height 0 (full verification, as before) and takes Core's minimum work. Regtest and custom signet get none. resolve_assume_valid picks the height from env, then config, then network; a configured height equal to the network's keeps the network's hash, so the binary's height-only seed keeps the anchor. Minimum work always comes from the network. The startup log prints it. Tests: tests/assumevalid_tests.rs checks every value against Core v31.1 display hex, and that the binary seed, zero-config, custom-height, env and custom-signet cases resolve as described.
This was referenced Oct 21, 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 remains after main
Josh's main fixed the dangerous part of this a different way:
assume_valid_heightnow requires an assume-valid hash.blvmbinary no longer seeds a hashless height.Together these mean main never skips scripts by default, so the "height with no hash and minimum work 0" critical is closed on main. No code from this PR is duplicated there, so nothing was dropped in the merge.
This PR now does something different: it restores Core-anchored assume-valid. Each network gets Bitcoin Core v31.1's
defaultAssumeValidheight and hash, plus itsnMinimumChainWork. Values come from https://github.com/bitcoin/bitcoin/blob/v31.1/src/kernel/chainparams.cpp:00000000000000000000ccebd6…1ba5ac0x1128750f82f4c366153a3a030000000007a61e423…6505b67f40x17dde1c649f3708d14b60x9a0fe15d0177d08630400000008414aab61…01ff5c3290xb463ea0a4b8resolve_assume_validpicks the height in this order:BLVM_ASSUME_VALID_HEIGHT, then the config file, then the network default.-noassumevalidstill turns the skip off.min_chain_work.Commits since the original: 8f658e3 merges node main 4f1be96, and 8ac954c updates a test doc comment to describe the height-only seed after 19da720.
Verification (Rust 1.88.0, branch head 8ac954c)
tests/assumevalid_tests.rs: 10 passed. The tests check every value against Core's display hex and cover:noassumevalidAgainst main's
src/these tests don't compile (core_assume_valid_for_networkandresolve_assume_validdon't exist there). Main's defaults are height-only (912683 / 4550000 / 267665) with no hash or minimum work, which since bbdaccb means no skip at all.config_parsing_tests: 44 passed. libconfig::: 16 passed.Full
cargo test --no-fail-fast: 3022 passed / 0 failed / 26 ignored (main 4f1be96: 3016 / 0 / 26; +6 new tests)cargo clippy --all-targets: the same 90 diagnostics as main, with 0 new. The 2nonminimal_boolerrors inchunk_assigner_tests.rsare already on main.rustfmt --checkon the touched files: clean. Main's existing fmt failure is intests/feature_flags_reflection_tests.rs:7.Review notes
git merge-treeclean with fix(rpc): stop reading the HTTP body at the configured cap #33–Optional: pass assume-valid ancestry to consensus (companion to blvm-consensus#24) #39)