Add TooManyUtxos error kind for utxos-limit failures - #243
Merged
EddieHouston merged 1 commit intoAug 7, 2026
Merged
Conversation
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
Randy808
approved these changes
Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_deltainsrc/new_index/schema.rs). For the UTXO check the message names the wrong limit — it fires when the UTXO set exceeds--utxos-limitduring history replay, regardless of history entry count. On deployments where--electrum-txs-limitis raised but--utxos-limitis left at default, an address can serve its full history whileGET /address/:addr/utxoandblockchain.scripthash.listunspentfail 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:
TooManyUtxoserror kind ("Too many unspent outputs") insrc/errors.rsutxo_deltainsrc/new_index/schema.rs, leavingTooPopularfor the two Electrum history checksTooManyUtxosto the same Electrum JSON-RPCBadRequest(code 1) asTooPopularinsrc/electrum/server.rsClient-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 checkandcargo check --features liquid(the one unused-import warning in the liquid build is pre-existing).