Skip to content

Skip the Blockaid bulk scan when no scannable assets are present - #3009

Open
devtechedge wants to merge 1 commit into
stellar:masterfrom
devtechedge:blockaid-empty-token-guard-2905
Open

devtechedge wants to merge 1 commit into
stellar:masterfrom
devtechedge:blockaid-empty-token-guard-2905

Conversation

@devtechedge

Copy link
Copy Markdown

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.

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
Copilot AI balanced review requested due to automatic review settings September 11, 2026 22:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Prevents unnecessary Blockaid bulk scans when standalone balances contain no scannable assets.

Changes:

  • Checks for asset_ids before 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")) {
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.

Dont call blockaid on empty token list

2 participants