Skip to content

Serve the chain tip and LightdInfo from cache - #577

Open
emersonian wants to merge 1 commit into
zcash:masterfrom
zecrocks:be/latest-block-cache
Open

Serve the chain tip and LightdInfo from cache#577
emersonian wants to merge 1 commit into
zcash:masterfrom
zecrocks:be/latest-block-cache

Conversation

@emersonian

Copy link
Copy Markdown
Contributor

(Not an NU6.3 urgency. I am in the process of porting over specific lightwalletd changes from the Zec.rocks fork, used on testnet and mainnet over the past year.)

GetLatestBlock and GetLatestTreeState issued a getblockchaininfo to the backend on every call, and GetLightdInfo issued getinfo plus getblockchaininfo. Wallets poll all three, so a busy server generated backend RPC load proportional to client count for data it already had.

This update serves the tip from the block cache, which the ingestor already keeps current, and gives GetLightdInfo a 5 second TTL. Both fall back to the RPC when the cache is disabled (--nocache) or still empty during initial sync, so behavior is unchanged in those cases.

GetLatestBlock and GetLatestTreeState issued a getblockchaininfo to the
backend on every call, and GetLightdInfo issued getinfo plus
getblockchaininfo. Wallets poll all three, so a busy server generated
backend RPC load proportional to client count for data it already had.

Serve the tip from the block cache, which the ingestor already keeps
current, and give GetLightdInfo a 5 second TTL — its fields are static or
slow-moving. Both fall back to the RPC when the cache is disabled
(--nocache) or still empty during initial sync, so behaviour is unchanged
in those cases.

GetLightdInfo returns a proto.Clone of the cached message rather than a
struct copy, since LightdInfo embeds a mutex.
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.

1 participant