Skip to content

fix: fallback to archival head when real-time head is null#129

Open
NikhilSharmaWe wants to merge 1 commit into
subsquid:masterfrom
NikhilSharmaWe:fix/head-archival-fallback
Open

fix: fallback to archival head when real-time head is null#129
NikhilSharmaWe wants to merge 1 commit into
subsquid:masterfrom
NikhilSharmaWe:fix/head-archival-fallback

Conversation

@NikhilSharmaWe

Copy link
Copy Markdown

Fixes #83

For hybrid datasets, GET /head and GET /finalized-head forwarded the raw hotblocks response to the client — returning null when hotblocks had no data yet, with no fallback to archival.

Root cause: the if dataset.hotblocks.is_some() branch activated for hybrid datasets and returned immediately, so the archival fallback below it was unreachable.

Fix: detect hybrid datasets with an inner network_id.is_some() check and route them through hybrid_head_response, which uses coalesce_head to prefer the real-time head and fall back to archival on any error (including a null body, which fails deserialization into BlockRef).

Mirrors the existing fallback in stream_from_network.

Only src/http_server.rs is changed.

Signed-off-by: Nikhil Sharma <nikhilsharma230303@gmail.com>
@NikhilSharmaWe

Copy link
Copy Markdown
Author

@kalabukdima, PTAL. Thanks

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.

Fallback to archival head when real-time head is null

1 participant