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

RPC calls optimization #251

Merged
merged 5 commits into from
Jul 20, 2020
Merged

RPC calls optimization #251

merged 5 commits into from
Jul 20, 2020

Conversation

stepansnigirev
Copy link
Contributor

@stepansnigirev stepansnigirev commented Jul 19, 2020

We do way too many calls to the RPC.
At the moment when I start Specter I see that rpc is called 300+ times - it will be a nightmare for a remote node.
I have plenty of wallets and transactions, but still this is something we should optimize.

I started doing it in this PR, reduced number of calls to ~30 per request (roughly 2 per wallet). And more if the wallet is selected.

Changes:

  • don't check transactions that we already checked - use listsinceblock instead of listtransactions
  • -1 call to getbalances
  • don't create wallets if they are already there
  • wallet.update() method to check balances and addresses
  • wallet.get_info() method to get rescan process
  • keep full reload of the wallet manager if user or chain have changed

Also added an RPC counter per request that we can uncomment during the development and see which and how many calls are done.

@stepansnigirev stepansnigirev marked this pull request as ready for review July 19, 2020 17:00
Copy link
Contributor

@ben-kaufman ben-kaufman left a comment

Choose a reason for hiding this comment

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

Looks good :)

@stepansnigirev stepansnigirev merged commit 2fa56e9 into cryptoadvance:master Jul 20, 2020
@stepansnigirev stepansnigirev deleted the less-rpc branch July 20, 2020 21:53
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.

2 participants