Skip to content

nmc(P1f): HeaderChain::get_locator — BIP31 block locator (+6 KATs, 52->58) - #199

Closed
frstrtr wants to merge 1 commit into
nmc/p1e-work-reorg-forkchoicefrom
nmc/p1f-header-locator
Closed

nmc(P1f): HeaderChain::get_locator — BIP31 block locator (+6 KATs, 52->58)#199
frstrtr wants to merge 1 commit into
nmc/p1e-work-reorg-forkchoicefrom
nmc/p1f-header-locator

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 19, 2026

Copy link
Copy Markdown
Owner

P1f — block locator (NMC HeaderChain)

P1e is complete (#197). This opens P1f: HeaderChain::get_locator() — the getheaders locator the SPV header-sync path needs.

What it does

  • Builds a BIP31-style block locator by walking the tip ancestry through m_previous_block: dense near the tip, stride doubles 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 shape.

Tests

+6 KATs (empty / single / dense-short / long-contiguous+root-anchored / backoff-stride / follows-tip-after-work-reorg). Full nmc_auxpow_merkle_test suite 52 -> 58 green; build clean.

Stacking

Based on #197 (nmc/p1e-work-reorg-forkchoice). Rebase to master once #197 lands. I do not self-merge.

…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
frstrtr deleted the branch nmc/p1e-work-reorg-forkchoice June 19, 2026 09:36
@frstrtr frstrtr closed this Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant