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: contributor

    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: contributor

    Concept ACK

  8. MarcoFalke cross-referenced this on Aug 25, 2021 from issue RPC documentation cleanup ideas by MarcoFalke
  9. MarcoFalke removed the label Wallet on Aug 25, 2021
  10. MarcoFalke removed the label Mining on Aug 25, 2021
  11. MarcoFalke added the label Docs on Aug 25, 2021
  12. 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.

  13. 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)

    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
    
  14. DrahtBot commented at 11:40 PM on August 25, 2021: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    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.

  15. DrahtBot cross-referenced this on Aug 26, 2021 from issue policy/rbf: don't return "incorrect" replaceability status by darosior
  16. DrahtBot cross-referenced this on Aug 26, 2021 from issue Remove -deprecatedrpc=addresses flag and corresponding code/logic by mjdietzx
  17. Herrytheeagle approved
  18. Herrytheeagle commented at 3:26 AM on August 26, 2021: none

    Properly fixed with the comment integration for clear and understandable codebase

  19. DrahtBot cross-referenced this on Aug 26, 2021 from issue docs: Update the explainer text for the listunspent RPC by Fonta1n3
  20. lsilva01 commented at 4:52 AM on August 26, 2021: contributor

    Concept ACK

  21. DrahtBot cross-referenced this on Aug 26, 2021 from issue rpc: add period_start to version bits statistics by Sjors
  22. DrahtBot cross-referenced this on Aug 26, 2021 from issue Implement BIP 370 PSBTv2 by achow101
  23. DrahtBot cross-referenced this on Aug 26, 2021 from issue wallet: indicate whether a transaction is in the mempool by danben
  24. DrahtBot cross-referenced this on Aug 26, 2021 from issue rpc, test: Improve getblockstats for unspendables by fjahr
  25. DrahtBot cross-referenced this on Aug 26, 2021 from issue docs: Document that 'fee' is unavailable when there are non-wallet inputs by shesek
  26. DrahtBot cross-referenced this on Aug 26, 2021 from issue RPC: Add ancestor{count,size,fees} to listunspent output by luke-jr
  27. practicalswift commented at 1:53 PM on September 4, 2021: contributor

    Concept ACK

  28. 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.

  29. 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?

  30. 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.

  31. 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.

  32. DrahtBot added the label Needs rebase on Sep 20, 2021
  33. doc: Fix RPC result documentation fa10fbc665
  34. MarcoFalke force-pushed on Sep 21, 2021
  35. MarcoFalke commented at 9:14 AM on September 21, 2021: member

    Force pushed to reply to feedback

  36. DrahtBot removed the label Needs rebase on Sep 21, 2021
  37. MarcoFalke closed this on Sep 21, 2021

  38. MarcoFalke reopened this on Sep 21, 2021

  39. MarcoFalke commented at 1:21 PM on September 21, 2021: member

    Failing CI can be ignored

  40. DrahtBot cross-referenced this on Sep 22, 2021 from issue psbt: Taproot fields for PSBT by achow101
  41. fanquake approved
  42. fanquake commented at 7:46 AM on September 23, 2021: member

    ACK fa10fbc6658fb8d87118cd550e4de406dca45f23

  43. fanquake merged this on Sep 23, 2021
  44. fanquake closed this on Sep 23, 2021

  45. MarcoFalke deleted the branch on Sep 23, 2021
  46. sidhujag referenced this in commit f28bac3d37 on Sep 24, 2021
  47. MarcoFalke cross-referenced this on Sep 24, 2021 from issue rpc: Fail to return undocumented or misdocumented JSON by MarcoFalke
  48. luke-jr referenced this in commit 6f0ccf0dd3 on Dec 14, 2021
  49. jnewbery cross-referenced this on Aug 25, 2022 from issue p2p: always provide CNodeStateStats and getpeerinfo/netinfo/gui updates by jonatack
  50. bitcoin 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: 2026-05-20 06:53 UTC