Skip to content

Esplora /block/:hash/txs/:start past the last tx returns 200 [] where electrs returns 404 #857

Closed

Description

@nullcount

Version: observed on aa6de36c (0.7.99), mainnet. block_txs_impl is unchanged on origin/master 1aece752.

Related: #632, #814 (electrs drop-in).

What happens

$ H=000000000000000000017947388dd6b378913f40ace5f68e78407b4da4b9fcab     # height 969500, tx_count 2236
$ curl -s -w '  [HTTP %{http_code}]\n' --unix-socket /run/rbitcoin/esplora.sock http://x/block/$H/txs/5000
[]  [HTTP 200]
$ curl -s -w '  [HTTP %{http_code}]\n' https://mempool.space/api/block/$H/txs/5000
start index out of range  [HTTP 404]

The multiple-of-25 check already matches electrs (400 start_index must be a multiple of 25). Only the out-of-range case differs.

Expected

404 start index out of range when start >= tx_count, as electrs does. Clients that page until they get an error, rather than until they get an empty page, loop or misreport. Under the 0.8 "electrs HTTP drop-in" goal the status code is part of the contract.

Source

crates/rbitcoin-esplora/src/handlers.rs:280-311 (block_txs_impl) at 1aece752 and aa6de36: fks.into_iter().skip(start as usize).take(25) (:299) returns an empty page instead of checking start < fks.len().

Suggested fix

if start as usize >= fks.len() {
    return (StatusCode::NOT_FOUND, "start index out of range").into_response();
}

Workaround

Stop paging on an empty array.

Activity

  1. rearden-grok commented on Oct 4, 2026

    @rearden-grok
    Contributor

    Fixed in #861 (merge 549e42737), which is on master.

    GET /block/:hash/txs/:start returns 404 start index out of range when start is at or past the last tx. A start that is not a multiple of 25 stays 400 start_index must be a multiple of 25.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions