Skip to content

Fix issue #1870: Add height range filtering to /boxes/unspent endpoint#2284

Open
dimension-drifter wants to merge 1 commit intoergoplatform:masterfrom
dimension-drifter:fix/issue1870
Open

Fix issue #1870: Add height range filtering to /boxes/unspent endpoint#2284
dimension-drifter wants to merge 1 commit intoergoplatform:masterfrom
dimension-drifter:fix/issue1870

Conversation

@dimension-drifter
Copy link

Problem:
The /wallet/boxes/unspent endpoint currently fetches ALL unspent wallet boxes from the database and then filters them in memory by height parameters (minInclusionHeight and maxInclusionHeight). This is inefficient, especially for wallets with many boxes.
The /wallet/transactions endpoint already implements efficient height-based filtering by querying the database directly with a height range using walletTxsBetween().

Solution:
This PR implements the same pattern for /wallet/boxes/unspent:

  1. Added walletUnspentBoxesByInclusionHeight() method to WalletRegistry to query boxes by height range directly from DB
  2. Updated GetWalletBoxes message to include minHeight and maxHeight parameters
  3. Updated ErgoWalletService.getWalletBoxes() to use height-based DB queries when height parameters are specified
  4. Updated the entire call chain (ErgoWalletActor, ErgoWalletReader, WalletApiRoute) to pass height parameters through

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.

1 participant