Skip to content

Misleading error message: --utxos-limit failures report "Too many history entries" #242

Description

@EddieHouston

Summary

ErrorKind::TooPopular has the display string "Too many history entries" (src/errors.rs#L22-L25), but it is raised from two unrelated checks:

  1. Electrum history queries — when results exceed --electrum-txs-limit (src/electrum/server.rs#L1011, #L414). The message is accurate here.
  2. UTXO set computation — when the UTXO set exceeds --utxos-limit during history replay (src/new_index/schema.rs#L873-L876). The message is wrong here: the failing condition is utxos.len() > limit and has nothing to do with history entry count.

Both limits default to 500, but they measure different quantities and are configured independently. On a deployment where --electrum-txs-limit has been raised but --utxos-limit is left at its default, an address with more than 500 UTXOs serves its full history without complaint while GET /address/:addr/utxo and blockchain.scripthash.listunspent fail with "Too many history entries" — a reason the server just demonstrated is not the problem.

The REST layer returns the error string verbatim as an HTTP 400 body (src/rest.rs#L543), so the misleading message is customer-visible and sends anyone debugging toward the wrong limit.

Observed behavior (signet address with 523 history entries, ~522 UTXOs)

Request Result
GET /address/{addr} 200 OK
GET /address/{addr}/txs 200 OK
blockchain.scripthash.get_history 200 OK — 523 entries
blockchain.scripthash.get_balance 200 OK
GET /address/{addr}/utxo 400 — "Too many history entries"
blockchain.scripthash.listunspent Error — "Too many history entries"

A related source of confusion: the UTXO check aborts when the set exceeds the limit at any point during replay (deliberately — the server must still materialize the peak-size map), so an address whose current balance is zero can also be refused with "Too many history entries". With a message naming the actual condition, that behavior would at least be interpretable.

Suggested fix

Add a distinct error kind and raise it from utxo_delta, leaving TooPopular for the Electrum history checks:

TooManyUtxos {
    description("Too many unspent outputs")
    display("Too many unspent outputs")
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions