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.
Draft PR to add a new
/address/:address/utxo/recent
REST API endpoint, which returns the most recentutxos_limit
confirmed utxos for the given address, plus all unconfirmed utxos, sorted in descending order of confirmation status & block height.Motivation
Unlike the existing
/address/:address/utxo
endpoint, this new API retrieves UTXOs by scanning address history in reverse chronological order, which means it can return early with useful data once it hits one of the resource limits, rather than throwing errors on addresses with excessive activity.This makes it more suitable for e.g. utxo charts and visualizations.
Implementation
The PR also adds a new config parameter
utxos_history_limit
, which defines the maximum number of transaction history entries to process while looking up utxos. If an address's utxos are buried beneath more than this number of history entries, the API may return early with fewer thanutxos_limit
confirmed utxos.Results are cached under a new cache_db key prefix
b'R'
.Todo