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

fix GetLatestBlock() gRPC (pure block cache) #415

Merged

Conversation

LarryRuane
Copy link
Collaborator

@LarryRuane LarryRuane commented Sep 16, 2022

Fixes #397. If the block cache is still populating (lightwalletd is syncing with zcashd), behave the same as if the cache was fully populated, other than performance.

This turned out to affect only the GetLatestBlock() gRPC. Previously, it would return the height and hash of the latest block in the cache. After this commit, it queries zcashd using the getblockchaininfo, which contains both of those values.

The only possible downside to this change is if the client calls GetLatestBlock() very frequently; with this change, each call requires an RPC to zcashd. But even a frequency of, say, once per second would be completely fine, and there's no reason it would be called more frequently than that (general range).

GetBlock() (and GetBlockRange()) already worked correctly; if the requested block isn't in the cache, it requests it from zcashd.

See issue 397. If the block cache is still populating (lightwalletd is
syncing with zcashd), behave the same as if the cache was fully
populated, other than performance.

This turned out to affect only the GetLatestBlock() gRPC. Previously, it
would return the height and hash of the latest block in the cache. After
this commit, it queries zcashd using the getblockchaininfo, which
contains both of those values.

GetBlock() (and GetBlockRange()) already worked correctly; if the
requested block isn't in the cache, it requests it from zcashd.
@LarryRuane LarryRuane added the bug Something isn't working label Sep 16, 2022
@LarryRuane LarryRuane self-assigned this Sep 16, 2022
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

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

utACK

Copy link
Contributor

@pacu pacu left a comment

Choose a reason for hiding this comment

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

utACK

@LarryRuane LarryRuane merged commit 4267cc9 into zcash:master Oct 20, 2022
@LarryRuane LarryRuane deleted the 2022-09-GetLatestBlock-pure-cache branch June 5, 2023 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the compact block cache a pure cache (its only effect is to improve performance)
3 participants