-
Notifications
You must be signed in to change notification settings - Fork 36.8k
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
doc: Fix RPC result documentation #22798
Conversation
Wow. Concept ACK. |
If RPC result documentation is fixed in bulk, maybe this can be added: #22430 |
Concept ACK |
@prayank23 My plan is to auto-generate the RPC examples, so that such issues are impossible. See #22799 for the meta issue. |
For reference, if someone wants to export the RPC docs to produce a rendered diff, the following patch might be useful: (dump_dir is a directory created by diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp
index cf80b08b96..6c6a71c6e4 100644
--- a/src/rpc/server.cpp
+++ b/src/rpc/server.cpp
@@ -95,7 +95,7 @@ std::string CRPCTable::help(const std::string& strCommand, const JSONRPCRequest&
{
const CRPCCommand *pcmd = command.second;
std::string strMethod = pcmd->name;
- if ((strCommand != "" || pcmd->category == "hidden") && strMethod != strCommand)
+ if ((strCommand != "") && strMethod != strCommand)
continue;
jreq.strMethod = strMethod;
try
diff --git a/test/functional/rpc_help.py b/test/functional/rpc_help.py
index de21f43747..753ee771ad 100755
--- a/test/functional/rpc_help.py
+++ b/test/functional/rpc_help.py
@@ -100,7 +100,7 @@ class HelpRpcTest(BitcoinTestFramework):
# command titles
titles = [line[3:-3] for line in node.help().splitlines() if line.startswith('==')]
- components = ['Blockchain', 'Control', 'Generating', 'Mining', 'Network', 'Rawtransactions', 'Util']
+ components = ['Blockchain', 'Control', 'Generating', 'Hidden', 'Mining', 'Network', 'Rawtransactions', 'Util']
if self.is_wallet_compiled():
components.append('Wallet')
@@ -116,7 +116,8 @@ class HelpRpcTest(BitcoinTestFramework):
def dump_help(self):
dump_dir = os.path.join(self.options.tmpdir, 'rpc_help_dump')
os.mkdir(dump_dir)
- calls = [line.split(' ', 1)[0] for line in self.nodes[0].help().splitlines() if line and not line.startswith('==')]
+ dump_dir = '/tmp/temp_git/' ##HACK
+ calls = [line.split(' ', 1)[0].split('|', 1)[0] for line in self.nodes[0].help().splitlines() if line and not line.startswith('==')]
for call in calls:
with open(os.path.join(dump_dir, call), 'w', encoding='utf-8') as f:
# Make sure the node can generate the help at runtime without crashing |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
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.
Properly fixed with the comment integration for clear and understandable codebase
Concept ACK |
Concept ACK |
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.
ACK fa1d3dd - Clearly this is a big improvement, some of the docs here are flat out wrong.
@@ -1078,22 +1083,23 @@ static RPCHelpMan decodepsbt() | |||
}}, |
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.
In decodepsbt
, looks like scriptPubKey
-> address
should also be marked optional.
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.
Thanks, fixed.
@@ -3426,6 +3429,10 @@ RPCHelpMan signrawtransactionwithwallet() | |||
{ | |||
{RPCResult::Type::STR_HEX, "txid", "The hash of the referenced, previous transaction"}, | |||
{RPCResult::Type::NUM, "vout", "The index of the output to spent and used as input"}, | |||
{RPCResult::Type::ARR, "witness", "", |
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.
Should be added to signrawtransactionwithkey()
as well?
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.
It already is?
{RPCResult::Type::NUM, "pingwait", "ping wait (if non-zero)"}, | ||
{RPCResult::Type::NUM, "pingtime", /* optional */ true, "ping time (if available)"}, | ||
{RPCResult::Type::NUM, "minping", /* optional */ true, "minimum observed ping time (if any at all)"}, | ||
{RPCResult::Type::NUM, "pingwait", /* optional */ true, "ping wait (if non-zero)"}, | ||
{RPCResult::Type::NUM, "version", "The peer version, such as 70001"}, | ||
{RPCResult::Type::STR, "subver", "The string version"}, | ||
{RPCResult::Type::BOOL, "inbound", "Inbound (true) or Outbound (false)"}, |
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.
Should startingheight
, synced_headers
, synced_blocks
.... addr_rate_limited
be optional as well? They are dependant on fStateStats
same as pingwait.
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.
Strictly they are conditional. Though I think the RPC should be changed to not be racy, unless there is a strong reason for it to prefer to be racy.
fa1d3dd
to
fa10fbc
Compare
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.
Force pushed to reply to feedback
{RPCResult::Type::NUM, "pingwait", "ping wait (if non-zero)"}, | ||
{RPCResult::Type::NUM, "pingtime", /* optional */ true, "ping time (if available)"}, | ||
{RPCResult::Type::NUM, "minping", /* optional */ true, "minimum observed ping time (if any at all)"}, | ||
{RPCResult::Type::NUM, "pingwait", /* optional */ true, "ping wait (if non-zero)"}, | ||
{RPCResult::Type::NUM, "version", "The peer version, such as 70001"}, | ||
{RPCResult::Type::STR, "subver", "The string version"}, | ||
{RPCResult::Type::BOOL, "inbound", "Inbound (true) or Outbound (false)"}, |
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.
Strictly they are conditional. Though I think the RPC should be changed to not be racy, unless there is a strong reason for it to prefer to be racy.
@@ -3426,6 +3429,10 @@ RPCHelpMan signrawtransactionwithwallet() | |||
{ | |||
{RPCResult::Type::STR_HEX, "txid", "The hash of the referenced, previous transaction"}, | |||
{RPCResult::Type::NUM, "vout", "The index of the output to spent and used as input"}, | |||
{RPCResult::Type::ARR, "witness", "", |
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.
It already is?
@@ -1078,22 +1083,23 @@ static RPCHelpMan decodepsbt() | |||
}}, |
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.
Thanks, fixed.
Failing CI can be ignored |
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.
ACK fa10fbc
Github-Pull: bitcoin#22798 Rebased-From: fa10fbc
Fix: