Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
[rpc] Add initialblockdownload to getblockchaininfo #11258
Conversation
laanwj
added
the
RPC/REST/ZMQ
label
Sep 6, 2017
|
Concept ACK
I don't like adding query string arguments to the RPC mechanism. This would add yet another way of passing in arguments, which is confusing, IMO. If this is to be made optional, adding an optional debug argument to |
|
utACK eb45b17 |
| @@ -1131,6 +1131,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request) | ||
| " \"difficulty\": xxxxxx, (numeric) the current difficulty\n" | ||
| " \"mediantime\": xxxxxx, (numeric) median time for the current best block\n" | ||
| " \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n" | ||
| + " \"initialblockdownload\": xxxx, (bool) is this node in Initial Block Download mode\n" |
MarcoFalke
Sep 6, 2017
Member
Maybe just mention that the meaning may change any time and it is only meant for debugging?
laanwj
Sep 6, 2017
Owner
I agree with @MarcoFalke, even though it might be useful in general this should mention that the interpretation (and possibly even use) of this is internal and subject to change.
| @@ -1131,6 +1131,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request) | ||
| " \"difficulty\": xxxxxx, (numeric) the current difficulty\n" | ||
| " \"mediantime\": xxxxxx, (numeric) median time for the current best block\n" | ||
| " \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n" | ||
| + " \"initialblockdownload\": xxxx, (bool) is this node in Initial Block Download mode\n" |
| + assert_equal(res["blocks"], 200) | ||
| + assert_equal(res["headers"], 200) | ||
| + assert_equal(len(res["bestblockhash"]), 64) | ||
| + assert "difficulty" in res |
promag
Sep 6, 2017
Contributor
Instead of multiple assert str in res, how about assert_equal(res.keys(), ...)? This way if someone adds a new response field or changes the response, it must update this tests too.
So only assert known values, and exact keys.
|
Another approach is to create the generic read-only calls:
In this case: Well, just an approach as @jnewbery asked |
|
@promag The idea is ok, though one problem is that that creates cross-cutting RPC calls, whereas we've been moving to subsystem-specific ones for a while (this was one of the reasons to get rid of the generic |
I don't agree with that, it only forces the same RPC API for all states, but each subsystem deals with it's states, it's not like So there would be a middleware where each subsystem must declare the available states and the RPC handler just delegates the state evaluation there. In other words, I also disagree with having fat RPC's, but I agree with one horizontal API. For instance, the config is horizontal for all subsystems. |
|
Concept ACK but I'm somewhat concerned that IsInitialBlockDownload means something that is not equal to what the user means by "in initial block download". A node is unable to know if its caught up or not, and this is a somewhat reliable heuristic. But for example, if you have a node partitioned off on some fork or something it may well return false here. The concern might be addressable by just throwing the word "estimated" or similar in there somewhere. |
|
ACK eb45b17 I agree slightly better to add some warning to the description of IBD, but that's a nit as far as I'm concerned |
|
|
Please remove the [WIP], when ready for review/merge |
jnewbery
changed the title from
[WIP] [rpc] Add initialblockdownload to getblockchaininfo
to
[rpc] Add initialblockdownload to getblockchaininfo
Sep 12, 2017
|
Ready for review/merge. PR title updated. Travis failed for |
|
@jnewbery Rebase to fix that. |
|
This was already rebased and we have the rm -rf in travis' yaml. I think the issue needs more investigation. (Might want to revert from the travis' yaml temporarily). |
|
Rebased. I've updated the help text to:
to address Greg's comment: #11258 (comment) No functional changes. I think this is ready for merge. |
jnewbery
added some commits
Sep 6, 2017
|
Silent rebase conflict. Should be fixed now |
|
The current commits only add comments to the functional test (claiming it tests it), but doesn't actually add any tests...? |
https://github.com/bitcoin/bitcoin/pull/11258/files#diff-31748911f612ce1d09bc82d04f452592R62 adds |
|
Unless @luke-jr expects a test for the value. |
Almost none of the fields from It's slightly frustrating that this is a minimal functionality PR that has been open for 2 months, ACK'ed by several people, rebased many times, and is now getting nitted because the test coverage for the new functionality doesn't exceed the test coverage for existing functionality. The fact that we're getting down to these micronits suggests it's time to merge this PR (or abandon it). |
|
utACK 1141364 |
jnewbery commentedSep 6, 2017
Exposing whether the node is in IBD would help for testing, and may be useful in general, particularly for developers.
First discussed in #10357 here: #10357 (review)
This PR currently implements the simplest way of doing this: adding an
initialblockdownloadfield togetblockchaininfo. Other approaches we could take:IBDand potentially other information.getblockchaininfo, egdebug_info, which would cause it to return debug information including IBD?debug=truewhich would cause RPCs to return additional debug information.I quite like the idea of (3). Feedback on these and other approaches very much welcomed!
@sdaftuar @laanwj