Skip the Blockaid bulk scan when no scannable assets are present - #3009
Open
devtechedge wants to merge 1 commit into
Open
devtechedge wants to merge 1 commit into
devtechedge wants to merge 1 commit into
Conversation
makeDisplayableBalances hit scan-asset-bulk even when the account held only native or LP-share balances, so the request went out with an empty token list, errored, and burned rate limit. The v2 balance path already guards this case; mirror that guard here. Fixes stellar#2905
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents unnecessary Blockaid bulk scans when standalone balances contain no scannable assets.
Changes:
- Checks for
asset_idsbefore fetching. - Avoids empty requests, errors, and wasted rate limits.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| console.error(e); | ||
| // Skip the scan entirely when there is nothing to scan: an empty token | ||
| // list makes the Blockaid call error out and wastes rate limit. | ||
| if (url.searchParams.has("asset_ids")) { |
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.
What and why
In `makeDisplayableBalances`, the `scan-asset-bulk` request went out whenever the account was on mainnet, even when every balance was native XLM or an LP share and nothing was appended to `asset_ids`. The empty token list made the Blockaid call error and consumed rate limit for nothing.
The v2 balance path (`addBlockaidScanResults`) already skips the scan when the scannable id list is empty; this mirrors that guard on the standalone path by checking `url.searchParams.has("asset_ids")` before fetching.
Fixes #2905
Testing
The touched helper is covered by existing suites; the behavior change only affects accounts with no scannable assets, which previously errored into the catch block.