Fix:
- Incorrectly named fields
- Add missing ones
- Add missing optional flag
Fix:
Wow. Concept ACK.
If RPC result documentation is fixed in bulk, maybe this can be added: https://github.com/bitcoin/bitcoin/pull/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 git init)
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
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, 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.
Properly fixed with the comment integration for clear and understandable codebase
Concept ACK
Concept ACK
1082 | @@ -1078,22 +1083,23 @@ static RPCHelpMan decodepsbt()
1083 | }},
In decodepsbt, looks like scriptPubKey -> address should also be marked optional.
Thanks, fixed.
3428 | @@ -3426,6 +3429,10 @@ RPCHelpMan signrawtransactionwithwallet() 3429 | { 3430 | {RPCResult::Type::STR_HEX, "txid", "The hash of the referenced, previous transaction"}, 3431 | {RPCResult::Type::NUM, "vout", "The index of the output to spent and used as input"}, 3432 | + {RPCResult::Type::ARR, "witness", "",
Should be added to signrawtransactionwithkey() as well?
It already is?
141 | + {RPCResult::Type::NUM, "pingtime", /* optional */ true, "ping time (if available)"}, 142 | + {RPCResult::Type::NUM, "minping", /* optional */ true, "minimum observed ping time (if any at all)"}, 143 | + {RPCResult::Type::NUM, "pingwait", /* optional */ true, "ping wait (if non-zero)"}, 144 | {RPCResult::Type::NUM, "version", "The peer version, such as 70001"}, 145 | {RPCResult::Type::STR, "subver", "The string version"}, 146 | {RPCResult::Type::BOOL, "inbound", "Inbound (true) or Outbound (false)"},
Should startingheight, synced_headers, synced_blocks .... addr_rate_limited be optional as well? They are dependant on fStateStats same as pingwait.
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.
ACK fa1d3ddaa35424ce92a1d3c31aa7a94787811281 - Clearly this is a big improvement, some of the docs here are flat out wrong.
Force pushed to reply to feedback
Failing CI can be ignored
ACK fa10fbc6658fb8d87118cd550e4de406dca45f23