Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only lookup staked account balance when needed #204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bilgehansahin
Copy link
Contributor

Currently we call GetStake for every account balance lookup call irrespective of the sub account type requested. In testnet this is not an issue but in mainnet, P-Chain getStake API calls can take upwards of 15-20 seconds. This change limits getStake calls to total (default) and staked sub account type balance.

Testing

Unit test, testnet data validation and mainnet spot check

Copy link
Contributor

@abi87 abi87 left a comment

Choose a reason for hiding this comment

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

@bilgehansahin the PR looks correct to me. I am not sure it is enough of a workaround for the GetStake latency issue (your test will confirm).
It's pretty annoying not to be able to cache utxos by height properly. As you may know we don't have any plan to support this natively on AvalancheGo, but Glacier here may be the right solution.

@bilgehansahin bilgehansahin force-pushed the pchain-balance-perf-fix branch from 17bada2 to 43bb554 Compare April 13, 2023 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants