Skip to content

fix(node): publish latest_block{block_hash} at startup - #18

Merged
MehranMazhar merged 1 commit into
mainfrom
fix/publish-latest-block-hash-at-startup
Sep 14, 2026
Merged

MehranMazhar merged 1 commit into
mainfrom
fix/publish-latest-block-hash-at-startup

Conversation

@MehranMazhar

Copy link
Copy Markdown
Member

What

Blockchain::new republishes latest_block_index from the stored block at startup. It does not republish latest_block{block_hash}, which is still written only by add_block_to_chain.

Why it matters

The explorer's indexer requires both series and refuses the chain head if either is missing:

match (latest_index, latest_hash) {
    (Some(height), Some(hash)) => Ok(RawHead { .. }),
    _ => Err(ExplorerError::Upstream("latest_block metrics missing".to_string())),
}

On a healthy chain the missing series appears within one slot, so this is invisible. On a halted chain it never appears — a node restart leaves the indexer permanently blind, and the explorer shows nothing regardless of what the chain is doing.

That is exactly how the stage halt of 2026-09-14 surfaced: reported as "the explorer has no data", three layers below the real fault.

Change

One statement in the startup arm that already publishes the index.

🤖 Generated with Claude Code

…mport

`latest_block_index` was already republished from the stored block at boot,
after a synced node holding 24,000 blocks reported height 0 until the next
block arrived. The hash-labelled `latest_block` series was left behind in that
fix and is still written only by `add_block_to_chain`.

That matters more than it sounds, because the explorer's indexer reads BOTH
series and refuses the chain head unless it has both
(`explorer/ingestion.rs::fetch_head` -> "latest_block metrics missing"). On a
healthy chain the gap closes within one slot. On a halted chain it never does:
a restart leaves the indexer permanently blind, so the explorer shows nothing
regardless of what the chain is doing. That is how the stage halt of
2026-09-14 was first reported -- three layers below the actual fault.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@MehranMazhar
MehranMazhar merged commit 8f1ca7c into main Sep 14, 2026
6 checks passed
@MehranMazhar
MehranMazhar deleted the fix/publish-latest-block-hash-at-startup branch September 14, 2026 14:54
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