doc: Fix RPC result documentation #22798

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2108-docRpc changing 7 files +145 −124
  1. MarcoFalke commented at 5:58 pm on August 25, 2021: member

    Fix:

    • Incorrectly named fields
    • Add missing ones
    • Add missing optional flag
  2. jonatack commented at 6:01 pm on August 25, 2021: member
    Wow. Concept ACK.
  3. ghost commented at 6:33 pm on August 25, 2021: none
    If RPC result documentation is fixed in bulk, maybe this can be added: https://github.com/bitcoin/bitcoin/pull/22430/
  4. DrahtBot added the label Mining on Aug 25, 2021
  5. DrahtBot added the label RPC/REST/ZMQ on Aug 25, 2021
  6. DrahtBot added the label Wallet on Aug 25, 2021
  7. theStack commented at 7:21 pm on August 25, 2021: member
    Concept ACK
  8. MarcoFalke removed the label Wallet on Aug 25, 2021
  9. MarcoFalke removed the label Mining on Aug 25, 2021
  10. MarcoFalke added the label Docs on Aug 25, 2021
  11. MarcoFalke commented at 7:22 pm on August 25, 2021: member
    @prayank23 My plan is to auto-generate the RPC examples, so that such issues are impossible. See #22799 for the meta issue.
  12. MarcoFalke commented at 7:44 pm on August 25, 2021: member

    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)

     0diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp
     1index cf80b08b96..6c6a71c6e4 100644
     2--- a/src/rpc/server.cpp
     3+++ b/src/rpc/server.cpp
     4@@ -95,7 +95,7 @@ std::string CRPCTable::help(const std::string& strCommand, const JSONRPCRequest&
     5     {
     6         const CRPCCommand *pcmd = command.second;
     7         std::string strMethod = pcmd->name;
     8-        if ((strCommand != "" || pcmd->category == "hidden") && strMethod != strCommand)
     9+        if ((strCommand != "") && strMethod != strCommand)
    10             continue;
    11         jreq.strMethod = strMethod;
    12         try
    13diff --git a/test/functional/rpc_help.py b/test/functional/rpc_help.py
    14index de21f43747..753ee771ad 100755
    15--- a/test/functional/rpc_help.py
    16+++ b/test/functional/rpc_help.py
    17@@ -100,7 +100,7 @@ class HelpRpcTest(BitcoinTestFramework):
    18         # command titles
    19         titles = [line[3:-3] for line in node.help().splitlines() if line.startswith('==')]
    20 
    21-        components = ['Blockchain', 'Control', 'Generating', 'Mining', 'Network', 'Rawtransactions', 'Util']
    22+        components = ['Blockchain', 'Control', 'Generating', 'Hidden', 'Mining', 'Network', 'Rawtransactions', 'Util']
    23 
    24         if self.is_wallet_compiled():
    25             components.append('Wallet')
    26@@ -116,7 +116,8 @@ class HelpRpcTest(BitcoinTestFramework):
    27     def dump_help(self):
    28         dump_dir = os.path.join(self.options.tmpdir, 'rpc_help_dump')
    29         os.mkdir(dump_dir)
    30-        calls = [line.split(' ', 1)[0] for line in self.nodes[0].help().splitlines() if line and not line.startswith('==')]
    31+        dump_dir = '/tmp/temp_git/' ##HACK
    32+        calls = [line.split(' ', 1)[0].split('|', 1)[0] for line in self.nodes[0].help().splitlines() if line and not line.startswith('==')]
    33         for call in calls:
    34             with open(os.path.join(dump_dir, call), 'w', encoding='utf-8') as f:
    35                 # Make sure the node can generate the help at runtime without crashing
    
  13. DrahtBot commented at 11:40 pm on August 25, 2021: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #22650 (Remove -deprecatedrpc=addresses flag and corresponding code/logic by mjdietzx)
    • #22558 (psbt: Taproot fields for PSBT by achow101)
    • #22525 (docs: Update the explainer text for the listunspent RPC by Fonta1n3)
    • #22016 (rpc: add period_start to version bits statistics by Sjors)
    • #21283 (Implement BIP 370 PSBTv2 by achow101)
    • #19888 (rpc, test: Improve getblockstats for unspendables by fjahr)
    • #19002 (docs: Document that ‘fee’ is unavailable when there are non-wallet inputs by shesek)

    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.

  14. Herrytheeagle approved
  15. Herrytheeagle commented at 3:26 am on August 26, 2021: none
    Properly fixed with the comment integration for clear and understandable codebase
  16. lsilva01 commented at 4:52 am on August 26, 2021: contributor
    Concept ACK
  17. practicalswift commented at 1:53 pm on September 4, 2021: contributor
    Concept ACK
  18. in src/rpc/rawtransaction.cpp:1083 in fa1d3ddaa3 outdated
    1082@@ -1078,22 +1083,23 @@ static RPCHelpMan decodepsbt()
    1083                                 }},
    


    fanquake commented at 7:07 am on September 10, 2021:
    In decodepsbt, looks like scriptPubKey -> address should also be marked optional.

    MarcoFalke commented at 9:12 am on September 21, 2021:
    Thanks, fixed.
  19. in src/wallet/rpcwallet.cpp:3448 in fa1d3ddaa3 outdated
    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", "",
    


    fanquake commented at 7:31 am on September 10, 2021:
    Should be added to signrawtransactionwithkey() as well?

    MarcoFalke commented at 9:12 am on September 21, 2021:
    It already is?
  20. in src/rpc/net.cpp:143 in fa1d3ddaa3 outdated
    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)"},
    


    fanquake commented at 8:00 am on September 10, 2021:
    Should startingheight, synced_headers, synced_blocks …. addr_rate_limited be optional as well? They are dependant on fStateStats same as pingwait.

    MarcoFalke commented at 9:08 am on September 21, 2021:
    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.
  21. fanquake commented at 8:03 am on September 10, 2021: member
    ACK fa1d3ddaa35424ce92a1d3c31aa7a94787811281 - Clearly this is a big improvement, some of the docs here are flat out wrong.
  22. DrahtBot added the label Needs rebase on Sep 20, 2021
  23. doc: Fix RPC result documentation fa10fbc665
  24. MarcoFalke force-pushed on Sep 21, 2021
  25. MarcoFalke commented at 9:14 am on September 21, 2021: member
    Force pushed to reply to feedback
  26. DrahtBot removed the label Needs rebase on Sep 21, 2021
  27. MarcoFalke closed this on Sep 21, 2021

  28. MarcoFalke reopened this on Sep 21, 2021

  29. MarcoFalke commented at 1:21 pm on September 21, 2021: member
    Failing CI can be ignored
  30. fanquake approved
  31. fanquake commented at 7:46 am on September 23, 2021: member
    ACK fa10fbc6658fb8d87118cd550e4de406dca45f23
  32. fanquake merged this on Sep 23, 2021
  33. fanquake closed this on Sep 23, 2021

  34. MarcoFalke deleted the branch on Sep 23, 2021
  35. sidhujag referenced this in commit f28bac3d37 on Sep 24, 2021
  36. luke-jr referenced this in commit 6f0ccf0dd3 on Dec 14, 2021
  37. DrahtBot locked this on Oct 30, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-18 06:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me