-
Notifications
You must be signed in to change notification settings - Fork 36.2k
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] Fix pruneheight help description in getblockchaininfo #11366
[rpc] Fix pruneheight help description in getblockchaininfo #11366
Conversation
utACK 9da936232743a2235dade998be7f01ce0cf1b709. Clarity is good. |
utACK 9da936232743a2235dade998be7f01ce0cf1b709 Also consider in this PR moving the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, I would reword commit and PR to something along [rpc] Fix pruneheight help description in getblockchaininfo
.
Otherwise utACK 9da9362.
src/rpc/blockchain.cpp
Outdated
@@ -1136,7 +1136,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request) | |||
" \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n" | |||
" \"chainwork\": \"xxxx\" (string) total amount of work in active chain, in hexadecimal\n" | |||
" \"pruned\": xx, (boolean) if the blocks are subject to pruning\n" | |||
" \"pruneheight\": xxxxxx, (numeric) lowest-height complete block stored\n" | |||
" \"pruneheight\": xxxxxx, (numeric) lowest-height complete block stored (if pruning is enabled)\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update to (only present if pruning is enabled)
. See this example for reference.
9da9362
to
887dcc4
Compare
Done and done, tested latest commit, appears in correct order. |
@@ -1180,6 +1180,14 @@ UniValue getblockchaininfo(const JSONRPCRequest& request) | |||
obj.push_back(Pair("verificationprogress", GuessVerificationProgress(Params().TxData(), chainActive.Tip()))); | |||
obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex())); | |||
obj.push_back(Pair("pruned", fPruneMode)); | |||
if (fPruneMode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is touched, update as per developer notes? {
in this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in #11367
if (fPruneMode) | ||
{ | ||
CBlockIndex *block = chainActive.Tip(); | ||
while (block && block->pprev && (block->pprev->nStatus & BLOCK_HAVE_DATA)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add { }
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove first condition block
and add assert(block);
above.
Suggest merging this with #11367 to avoid PR dependencies? |
Changes are now included in #11367. |
f6ffb14 [test] Add getblockchaininfo functional test (João Barbosa) fd8f45f [test] Add restart_node to BitcoinTestFramework (João Barbosa) Pull request description: Adds functional test for `getblockchaininfo`. Also deals with the fact that `pruneheight` is only in the response when pruning is enabled (related to #11366). Tree-SHA512: 56cdec0921f572874f2fdded0990d1722d1435c3ff9979e6bff1afdccdca6f8b214dbe8d7490cdac07b5758909db085132d14340de2cce943241f7ebde7e5b6c
f6ffb14 [test] Add getblockchaininfo functional test (João Barbosa) fd8f45f [test] Add restart_node to BitcoinTestFramework (João Barbosa) Pull request description: Adds functional test for `getblockchaininfo`. Also deals with the fact that `pruneheight` is only in the response when pruning is enabled (related to bitcoin#11366). Tree-SHA512: 56cdec0921f572874f2fdded0990d1722d1435c3ff9979e6bff1afdccdca6f8b214dbe8d7490cdac07b5758909db085132d14340de2cce943241f7ebde7e5b6c
f6ffb14 [test] Add getblockchaininfo functional test (João Barbosa) fd8f45f [test] Add restart_node to BitcoinTestFramework (João Barbosa) Pull request description: Adds functional test for `getblockchaininfo`. Also deals with the fact that `pruneheight` is only in the response when pruning is enabled (related to bitcoin#11366). Tree-SHA512: 56cdec0921f572874f2fdded0990d1722d1435c3ff9979e6bff1afdccdca6f8b214dbe8d7490cdac07b5758909db085132d14340de2cce943241f7ebde7e5b6c
f6ffb14 [test] Add getblockchaininfo functional test (João Barbosa) fd8f45f [test] Add restart_node to BitcoinTestFramework (João Barbosa) Pull request description: Adds functional test for `getblockchaininfo`. Also deals with the fact that `pruneheight` is only in the response when pruning is enabled (related to bitcoin#11366). Tree-SHA512: 56cdec0921f572874f2fdded0990d1722d1435c3ff9979e6bff1afdccdca6f8b214dbe8d7490cdac07b5758909db085132d14340de2cce943241f7ebde7e5b6c
f6ffb14 [test] Add getblockchaininfo functional test (João Barbosa) fd8f45f [test] Add restart_node to BitcoinTestFramework (João Barbosa) Pull request description: Adds functional test for `getblockchaininfo`. Also deals with the fact that `pruneheight` is only in the response when pruning is enabled (related to bitcoin#11366). Tree-SHA512: 56cdec0921f572874f2fdded0990d1722d1435c3ff9979e6bff1afdccdca6f8b214dbe8d7490cdac07b5758909db085132d14340de2cce943241f7ebde7e5b6c
f6ffb14 [test] Add getblockchaininfo functional test (João Barbosa) fd8f45f [test] Add restart_node to BitcoinTestFramework (João Barbosa) Pull request description: Adds functional test for `getblockchaininfo`. Also deals with the fact that `pruneheight` is only in the response when pruning is enabled (related to bitcoin#11366). Tree-SHA512: 56cdec0921f572874f2fdded0990d1722d1435c3ff9979e6bff1afdccdca6f8b214dbe8d7490cdac07b5758909db085132d14340de2cce943241f7ebde7e5b6c
f6ffb14 [test] Add getblockchaininfo functional test (João Barbosa) fd8f45f [test] Add restart_node to BitcoinTestFramework (João Barbosa) Pull request description: Adds functional test for `getblockchaininfo`. Also deals with the fact that `pruneheight` is only in the response when pruning is enabled (related to bitcoin#11366). Tree-SHA512: 56cdec0921f572874f2fdded0990d1722d1435c3ff9979e6bff1afdccdca6f8b214dbe8d7490cdac07b5758909db085132d14340de2cce943241f7ebde7e5b6c
f6ffb14 [test] Add getblockchaininfo functional test (João Barbosa) fd8f45f [test] Add restart_node to BitcoinTestFramework (João Barbosa) Pull request description: Adds functional test for `getblockchaininfo`. Also deals with the fact that `pruneheight` is only in the response when pruning is enabled (related to bitcoin#11366). Tree-SHA512: 56cdec0921f572874f2fdded0990d1722d1435c3ff9979e6bff1afdccdca6f8b214dbe8d7490cdac07b5758909db085132d14340de2cce943241f7ebde7e5b6c
f6ffb14 [test] Add getblockchaininfo functional test (João Barbosa) fd8f45f [test] Add restart_node to BitcoinTestFramework (João Barbosa) Pull request description: Adds functional test for `getblockchaininfo`. Also deals with the fact that `pruneheight` is only in the response when pruning is enabled (related to bitcoin#11366). Tree-SHA512: 56cdec0921f572874f2fdded0990d1722d1435c3ff9979e6bff1afdccdca6f8b214dbe8d7490cdac07b5758909db085132d14340de2cce943241f7ebde7e5b6c
This is a bit nitpicky, but the field isn't included in the JSON at all unless fPruneMode is set.
Alternatively we could return 0 (and remove 'pruned', which would then be pointless, but someone might be relying on that).