Skip to content

Add TooManyUtxos error kind for utxos-limit failures - #243

Merged
EddieHouston merged 1 commit into
Blockstream:new-indexfrom
EddieHouston:agent/too-many-utxos-error-message
Aug 7, 2026
Merged

Add TooManyUtxos error kind for utxos-limit failures#243
EddieHouston merged 1 commit into
Blockstream:new-indexfrom
EddieHouston:agent/too-many-utxos-error-message

Conversation

@EddieHouston

@EddieHouston EddieHouston commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Fixes #242.

ErrorKind::TooPopular ("Too many history entries") was raised from two unrelated checks: the Electrum history limit (--electrum-txs-limit, src/electrum/server.rs) and the UTXO set limit (--utxos-limit, utxo_delta in src/new_index/schema.rs). For the UTXO check the message names the wrong limit — it fires when the UTXO set exceeds --utxos-limit during history replay, regardless of history entry count. On deployments where --electrum-txs-limit is raised but --utxos-limit is left at default, an address can serve its full history while GET /address/:addr/utxo and blockchain.scripthash.listunspent fail with a message blaming history size. The REST layer returns the display string verbatim as the HTTP 400 body, so the misleading message is customer-visible.

Changes:

  • Add a distinct TooManyUtxos error kind ("Too many unspent outputs") in src/errors.rs
  • Raise it from utxo_delta in src/new_index/schema.rs, leaving TooPopular for the two Electrum history checks
  • Map TooManyUtxos to the same Electrum JSON-RPC BadRequest (code 1) as TooPopular in src/electrum/server.rs

Client-visible change: the HTTP 400 body / Electrum error message for over-limit UTXO queries becomes "Too many unspent outputs" instead of "Too many history entries". The Electrum error code is unchanged (BadRequest = 1); only the message text differs.

Verified with cargo check and cargo check --features liquid (the one unused-import warning in the liquid build is pre-existing).

The UTXO set computation in utxo_delta reused ErrorKind::TooPopular, whose
display string is "Too many history entries". That message names the wrong
limit: the check fires when the UTXO set exceeds utxos-limit during history
replay, independent of history entry count. On deployments where
electrum-txs-limit is raised but utxos-limit is not, an address could serve
its full history while /address/:addr/utxo and listunspent failed with a
message blaming history size.

Raise a distinct TooManyUtxos kind ("Too many unspent outputs") from
utxo_delta and map it to the same Electrum BadRequest code, leaving
TooPopular for the Electrum history checks.

Fixes Blockstream#242
@EddieHouston
EddieHouston merged commit e809f0d into Blockstream:new-index Aug 7, 2026
6 checks passed
@EddieHouston
EddieHouston deleted the agent/too-many-utxos-error-message branch August 7, 2026 15:13
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.

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

2 participants