rpc: Correct RPCHelpMan for fundrawtransaction's input_weights field #26795

pull jdjkelly wants to merge 1 commits into bitcoin:master from jdjkelly:rpc/fundrawtransaction-input-weights changing 1 files +11 −7
  1. jdjkelly commented at 7:40 PM on January 2, 2023: contributor

    input_weights is incorrectly documented as a fixed length JSON array, but it is actually a JSON array of JSON objects - this commit changes input_weights to use RPCArg::Type::OBJ

    The behavior of input_weights as an object exists as a functional test in wallet_fundrawtransaction.py.

  2. rpc: Correct RPCHelpMan for fundrawtransaction's input_weights field
    input_weights is incorrectly documented as a fixed length JSON array,
    but it is actually a JSON array of JSON objects - this commit changes
    input_weights to use RPCArg::Type::OBJ
    927b8d4e0c
  3. DrahtBot commented at 7:41 PM on January 2, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK achow101
    Concept ACK MarcoFalke

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. DrahtBot added the label RPC/REST/ZMQ on Jan 2, 2023
  5. jdjkelly commented at 7:42 PM on January 2, 2023: contributor

    @MarcoFalke I couldn't figure out how to generate a documentation diff, is this included in bitcoin/bitcoin or another repository?

  6. maflcko commented at 8:49 AM on January 3, 2023: member

    You can just write the help to a file and compare it. I use the following diff:

    diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp
    index 9f57a56297..be5fe4084f 100644
    --- a/src/rpc/server.cpp
    +++ b/src/rpc/server.cpp
    @@ -96,7 +96,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 7acc3cbbd5..a5d8e28b8c 100755
    --- a/test/functional/rpc_help.py
    +++ b/test/functional/rpc_help.py
    @@ -103,7 +103,7 @@ class HelpRpcTest(BitcoinTestFramework):
             # command titles
             titles = [line[3:-3] for line in node.help().splitlines() if line.startswith('==')]
     
    -        components = ['Blockchain', 'Control', 'Mining', 'Network', 'Rawtransactions', 'Util']
    +        components = ['Blockchain', 'Control', 'Hidden', 'Mining', 'Network', 'Rawtransactions', 'Util']
     
             if self.is_wallet_compiled():
                 components.append('Wallet')
    @@ -119,7 +119,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
    

    Which gives:

    diff --git a/fundrawtransaction b/fundrawtransaction
    index e3cc549..5ffcb3a 100644
    --- a/fundrawtransaction
    +++ b/fundrawtransaction
    @@ -38,9 +38,11 @@ Arguments:
              ...
            ],
            "input_weights": [             (json array, optional) Inputs and their corresponding weights
    -         "txid",                      (string, required) The transaction id
    -         vout,                        (numeric, required) The output index
    -         weight,                      (numeric, required) The maximum weight for this input, including the weight of the outpoint and sequence number. Note that serialized signature sizes are not guaranteed to be consistent, so the maximum DER signatures size of 73 bytes should be used when considering ECDSA signatures.Remember to convert serialized sizes to weight units when necessary.
    +         {                            (json object)
    +           "txid": "hex",             (string, required) The transaction id
    +           "vout": n,                 (numeric, required) The output index
    +           "weight": n,               (numeric, required) The maximum weight for this input, including the weight of the outpoint and sequence number. Note that serialized signature sizes are not guaranteed to be consistent, so the maximum DER signatures size of 73 bytes should be used when considering ECDSA signatures.Remember to convert serialized sizes to weight units when necessary.
    +         },
              ...
            ],
            "conf_target": n,              (numeric, optional, default=wallet -txconfirmtarget) Confirmation target in blocks
    
  7. maflcko commented at 11:45 AM on January 3, 2023: member

    For reference, the issue fixed here will be caught by part (2/2), a follow-up of #26039

  8. achow101 commented at 8:19 PM on January 3, 2023: member

    ACK 927b8d4e0cddd89e1f71093c10bd697c25b7a7d8

  9. jdjkelly commented at 2:37 AM on January 4, 2023: contributor

    For reference, the issue fixed here will be caught by part (2/2), a follow-up of #26039

    Thanks, I will give that a read through

  10. fanquake merged this on Jan 4, 2023
  11. fanquake closed this on Jan 4, 2023

  12. jdjkelly deleted the branch on Jan 4, 2023
  13. sidhujag referenced this in commit 268f987706 on Jan 4, 2023
  14. bitcoin locked this on Jan 4, 2024

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-04-13 15:13 UTC

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