nmc(P1f): HeaderChain::get_locator — BIP31 block locator over tip ancestry - #200
Merged
Conversation
…estry Build a getheaders block locator by walking the tip ancestry through m_previous_block with BIP31-style exponential backoff: dense near the tip, doubling the stride past the first 10 entries, chain root always anchored. Walking parent links follows the best chain we just fork-chose, so the locator stays correct across reorgs without a separate height index. Mirrors src/impl/btc/coin/header_chain.hpp. +6 KATs (empty / single / dense-short / long-contiguous-anchored / backoff / follows-tip-after-reorg); suite 52 -> 58 green.
frstrtr
added a commit
that referenced
this pull request
Jun 19, 2026
…->64) Rebased onto master (771f586) post-#200/get_locator. Persists every accepted entry under "h"+block_hash (IndexEntryDiskV1), plus tip/height pointers, in one synced WriteBatch; init() restores m_index/m_tip/m_tip_height/m_best_work via load_from_db(). NMC has no height-index (full-residency m_index), so no "i" key. Auxpow blob deferred (presence flag only). Coexists with get_locator: 6 persist KATs + 6 locator KATs = 58->64 green.
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.
Revived from #199 (collaterally auto-closed when #197 merge deleted its stack base nmc/p1e-work-reorg-forkchoice). Rebased onto master @bd1f0e26, head 04b3c8f.
P1f get_locator() leg: BIP31 block locator walking tip ancestry via m_previous_block (exponential step-back, no height index), mirroring btc HeaderChain. Pure mechanism, no consensus value.
NMC tree only: src/impl/nmc/coin/header_chain.hpp + src/impl/nmc/test/auxpow_merkle_test.cpp. +6 KATs, suite 52->58 green.
Fenced-skeleton: NMC-only, no shared/other-coin surface.