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

Send the same getblocktemplate RPC response until the template would change #5604

Open
Tracked by #5234 ...
teor2345 opened this issue Nov 9, 2022 · 0 comments
Open
Tracked by #5234 ...
Labels
A-concurrency Area: Async code, needs extra work to make it work properly. A-rpc Area: Remote Procedure Call interfaces C-enhancement Category: This is an improvement I-slow Problems with performance or responsiveness S-needs-triage Status: A bug report needs triage

Comments

@teor2345
Copy link
Contributor

teor2345 commented Nov 9, 2022

Motivation

str4d told us that zcashd caches its getblocktemplate RPC response when the RPC is called frequently. This can improve RPC performance, which is important for miner profits.

The getblocktemplate response must change when:

  • the best tip hash changes (Zebra's ChainTip watch channel)
  • the max time is reached

The getblocktemplate response can also change, but is not required to change, when:

  • the mempool adds or evicts transactions

Designs

  • Cache the getblocktemplate RPC response based on the long polling ID
  • Delete the cached RPC value if the long polling ID would change
  • If there is a cached value, return it when the RPC is called
  • Don't cache invalid templates (like Don't return from long polling if the block template is an invalid block proposal #6037)
    • Mark invalid templates in the cache so we don't try to re-send or re-check them
    • Return a RPC error if we don't find a valid template within a target block interval or two

Related Work

This will be easy to implement after long polling support in #5720

@teor2345 teor2345 added C-enhancement Category: This is an improvement S-needs-triage Status: A bug report needs triage I-slow Problems with performance or responsiveness P-Optional ✨ A-rpc Area: Remote Procedure Call interfaces labels Nov 9, 2022
@teor2345 teor2345 changed the title Send the same getblocktemplate RPC response until the chain tip changes Send the same getblocktemplate RPC response until the template would change Dec 4, 2022
@teor2345 teor2345 added the A-concurrency Area: Async code, needs extra work to make it work properly. label Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-concurrency Area: Async code, needs extra work to make it work properly. A-rpc Area: Remote Procedure Call interfaces C-enhancement Category: This is an improvement I-slow Problems with performance or responsiveness S-needs-triage Status: A bug report needs triage
Projects
Status: New
Development

No branches or pull requests

2 participants