rest: Allow fetching stale header #35909

pull davidgumberg wants to merge 3 commits into bitcoin:master from davidgumberg:2026-08-05-rest-staleheader changing 6 files +134 −28
  1. davidgumberg commented at 10:42 PM on August 5, 2026: contributor

    This is one approach that would resolve #35897.

    Being able to request stale block headers is useful for clients that want to learn the ancestors of a blockhash e.g. when following a re-org up and matches the functionality of the getblockheader RPC.

    This branch takes the approach that a user has to set count=1 and opt-in to non-active-chain blocks with activechainonly=false.

    Alternative approaches:

    Fetching stale blocks when count=1 without a new param

    Hyrum's Law suggests that a client out there relies on the property that /headers/ returns [] for non-active-chain blocks, so this is probably dangerous.

    A separate /header/ interface

    This is nice because it avoids the parameter matrix, and we can have a REST path that matches the semantics of getblockheader, but I am not sure if this is worth the additional implementation complexity, but I could rework towards this approach if others feel strongly.

    Another rest endpoint that supports negative ranges

    e.g. see #33752


    LLM Disclosure: Used as a research tool and rubber ducky while making this PR, but all code and text came from some indeterminate place inside my body.

  2. rest: refactor: Extract bool param parsing logic into a helper. 31e38d8542
  3. rest: /headers/activechainonly=false to allow querying stale blocks. f5c9d8289c
  4. doc: Add release note and usage for activechainonly REST param. bd9d6bc4e9
  5. DrahtBot added the label RPC/REST/ZMQ on Aug 5, 2026
  6. DrahtBot commented at 10:42 PM on August 5, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35909.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    Concept ACK sedited

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  7. sedited commented at 6:14 AM on August 6, 2026: contributor

    Concept ACK


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-08-11 14:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me