forked from Bitcoin-ABC/bitcoin-abc
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add -
gbtcheckvalidity
arg to CLI;"checkvalidity"
arg to GBT(L)
Summary --- As discussed in Slack, perhaps it would be beneficial to optionally skip the slow `TestBlockValidity` checks when generating a block template. These checks dominate block template creation for large blocks, and in some cases perhaps advanced users (miners, etc) may want to skip these checks. Note that it is a bug in this codebase if we *ever* generate an invalid block template anyway, so the checks are largely redundant. Additoinally, while working on this code, I noticed: - RPC help for GBT(L) is incomplete. I added the missing `"longpollid"` documentation. - RPC help for GBT(L) had some redundant pieces. I put the duplicated stuff into a common static function `getGBTArgs()`. This makes it easier to maintain the arg code for those two very strongly related functions. - I noticed it's annoying when testing that block templates are cached. Perhaps we want to skip caching, especially when testing. I added the optional RPC argument to the `template_request` called `"ignorecache"` which, if true, always skips the cached block template and generates a new one. Summary of Changes --- - New arg: `-gbtcheckvalidity` to control the default setting for gbt(l). If false, we skip the validity checks when generating a block template (default: true) - Added help doc for `"longpollid"` `template_request` argument in RPC for gbt(l) - Added optional `"ignorecache"` `template_request` argument (default: false) to skip the cached block template unconditionally (useful for testing). - Added optional `"checkvalidity"` `template_request` argument (default: whatever `-gbtcheckvalidity` was set to on CLI), which controls the validity checker on a per-template basis. - Refactored the help for `getblocktemplate` and `getblocktemplatelight` into a common function. - In `checkvalidity=false` mode, also skip the redundant and wasteful calculation of block size for the 6th time just to print it to debug log (and instead use the estimated worst-case size we already know). Test Plan --- 1. Review 2. `ninja all check` 3. `test/functional/test_runner.py bchn-rpc-gbt-checkvalidity-ignorecache`
- Loading branch information
Showing
7 changed files
with
228 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.