rpc: RPCHelpMan fixes #21913

pull kallewoof wants to merge 5 commits into bitcoin:master from kallewoof:202104-rpchelpman-fixes2 changing 4 files +10 −10
  1. kallewoof commented at 10:16 AM on May 11, 2021: member

    This is a follow-up to #21897, and I believe covers the remaining cases, at least that I could find.

    Edited to remove unrelated information about a side project.

  2. rpc/gettxoutsetinfo: hash_or_height is a named argument eb4fb7e507
  3. rpc/getpeerinfo: bytesrecv_per_msg is a dynamic dictionary
    It is not a dictionary with the single key 'msg'.
    c8cf0a3d51
  4. rpc: address:amount dictionaries are OBJ_USER_KEYS dc4db23b30
  5. DrahtBot added the label RPC/REST/ZMQ on May 11, 2021
  6. DrahtBot added the label Wallet on May 11, 2021
  7. jonatack commented at 11:19 AM on May 11, 2021: member

    Concept ACK. I wasn't aware of these (new?) RPCHelpMan methods.

  8. rpc/createwallet: omitted named arguments
    The current output for passphrase results in a non-optional passphrase which is incorrect.
    4983f4cba4
  9. in src/wallet/rpcwallet.cpp:2699 in 92709d0516 outdated
    2695 | @@ -2696,7 +2696,7 @@ static RPCHelpMan createwallet()
    2696 |              {"wallet_name", RPCArg::Type::STR, RPCArg::Optional::NO, "The name for the new wallet. If this is a path, the wallet will be created at the path location."},
    2697 |              {"disable_private_keys", RPCArg::Type::BOOL, RPCArg::Default{false}, "Disable the possibility of private keys (only watchonlys are possible in this mode)."},
    2698 |              {"blank", RPCArg::Type::BOOL, RPCArg::Default{false}, "Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using sethdseed."},
    2699 | -            {"passphrase", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Encrypt the wallet with this passphrase."},
    2700 | +            {"passphrase", RPCArg::Type::STR, RPCArg::Default{UniValue::VNULL}, "Encrypt the wallet with this passphrase."},
    


    MarcoFalke commented at 11:21 AM on May 11, 2021:

    top level arguments are always Null if omitted. What makes this one special?


    kallewoof commented at 11:53 AM on May 11, 2021:

    @MarcoFalke This is the only one without the "optional" keyword in the help:

    Arguments:
    1. wallet_name             (string, required) The name for the new wallet. If this is a path, the wallet will be created at the path location.
    2. disable_private_keys    (boolean, optional, default=false) Disable the possibility of private keys (only watchonlys are possible in this mode).
    3. blank                   (boolean, optional, default=false) Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using sethdseed.
    4. passphrase              (string) Encrypt the wallet with this passphrase.
    5. avoid_reuse             (boolean, optional, default=false) Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind.
    6. descriptors             (boolean, optional, default=false) Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation
    7. load_on_startup         (boolean, optional, default=null) Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged.
    

    kallewoof commented at 11:57 AM on May 11, 2021:

    Either way, this one is not OMITTED which is described as

            /**
             * Optional argument with default value omitted because they are
             * implicitly clear. That is, elements in an array or object may not
             * exist by default.
             * When possible, the default value should be specified.
             */
            OMITTED,
    

    Instead, alternatively, it is OMITTED_NAMED_ARG (its name is "passphrase") or as above, given a null default:

            /**
             * Optional arg that is a named argument and has a default value of
             * `null`. When possible, the default value should be specified.
             */
            OMITTED_NAMED_ARG,
    

    kallewoof commented at 12:04 PM on May 11, 2021:

    Actually I painted myself into the opinion that this actually is OMITTED_NAMED_ARG so I've pushed that change. Sorry for the spam.

  10. kallewoof force-pushed on May 11, 2021
  11. rpc/wallet: use OMITTED_NAMED_ARG instead of Default(VNULL) 6e2eb0d63b
  12. promag commented at 8:26 AM on May 12, 2021: member

    Code review ACK 6e2eb0d63b42288c11a65d585d487108643888d0.

  13. kallewoof commented at 5:29 AM on May 13, 2021: member

    Rendered diff:

    diff --git a/help-output-master.txt b/help-output-21913.txt
    index ee49aa730..455e8d455 100644
    --- a/help-output-master.txt
    +++ b/help-output-21913.txt
    @@ -6,7 +6,7 @@ Note this call may take some time if you are not using coinstatsindex.
     
     Arguments:
     1. hash_type         (string, optional, default="hash_serialized_2") Which UTXO set hash should be calculated. Options: 'hash_serialized_2' (the legacy algorithm), 'muhash', 'none'.
    -2. hash_or_height    (string or numeric) The block hash or height of the target height (only available with coinstatsindex).
    +2. hash_or_height    (string or numeric, optional) The block hash or height of the target height (only available with coinstatsindex).
     3. use_index         (boolean, optional, default=true) Use coinstatsindex, if available.
     
     Result:
    @@ -108,10 +108,11 @@ Result:
           ...
         },
         "bytesrecv_per_msg" : {           (json object)
    -      "msg" : n                       (numeric) The total bytes received aggregated by message type
    +      "msg" : n,                      (numeric) The total bytes received aggregated by message type
                                           When a message type is not listed in this json object, the bytes received are 0.
                                           Only known message types can appear as keys in the object and all bytes received
                                           of unknown message types are listed under '*other*'.
    +      ...
         },
         "connection_type" : "str"         (string) Type of connection: 
                                           outbound-full-relay (default automatic connections),
    @@ -131,7 +132,7 @@ Examples:
     > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getpeerinfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
     
     === createpsbt ===
    -createpsbt [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount},{"data":"hex"},...] ( locktime replaceable )
    +createpsbt [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount,...},{"data":"hex"},...] ( locktime replaceable )
     
     Creates a transaction in the Partially Signed Transaction format.
     Implements the Creator role.
    @@ -153,6 +154,7 @@ Arguments:
          [
            {                       (json object)
              "address": amount,    (numeric or string, required) A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in BTC
    +         ...
            },
            {                       (json object)
              "data": "hex",        (string, required) A key-value pair. The key must be "data", the value is hex-encoded data
    @@ -170,7 +172,7 @@ Examples:
     > bitcoin-cli createpsbt "[{\"txid\":\"myid\",\"vout\":0}]" "[{\"data\":\"00010203\"}]"
     
     === sendmany ===
    -sendmany "" {"address":amount} ( minconf "comment" ["address",...] replaceable conf_target "estimate_mode" fee_rate verbose )
    +sendmany "" {"address":amount,...} ( minconf "comment" ["address",...] replaceable conf_target "estimate_mode" fee_rate verbose )
     
     Send multiple times. Amounts are double-precision floating point numbers.
     Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted.
    @@ -180,6 +182,7 @@ Arguments:
     2. amounts                   (json object, required) The addresses and amounts
          {
            "address": amount,    (numeric or string, required) The bitcoin address is the key, the numeric amount (can be string) in BTC is the value
    +       ...
          }
     3. minconf                   (numeric, optional) Ignored dummy value
     4. comment                   (string, optional) A comment
    @@ -234,7 +237,7 @@ applied to the new wallet (eg -rescan, etc).
     
     Arguments:
     1. filename           (string, required) The wallet directory or .dat file.
    -2. load_on_startup    (boolean, optional, default=null) Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged.
    +2. load_on_startup    (boolean, optional) Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged.
     
     Result:
     {                       (json object)
    @@ -255,10 +258,10 @@ Arguments:
     1. wallet_name             (string, required) The name for the new wallet. If this is a path, the wallet will be created at the path location.
     2. disable_private_keys    (boolean, optional, default=false) Disable the possibility of private keys (only watchonlys are possible in this mode).
     3. blank                   (boolean, optional, default=false) Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using sethdseed.
    -4. passphrase              (string) Encrypt the wallet with this passphrase.
    +4. passphrase              (string, optional) Encrypt the wallet with this passphrase.
     5. avoid_reuse             (boolean, optional, default=false) Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind.
     6. descriptors             (boolean, optional, default=false) Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation
    -7. load_on_startup         (boolean, optional, default=null) Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged.
    +7. load_on_startup         (boolean, optional) Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged.
     8. external_signer         (boolean, optional, default=false) Use an external signer such as a hardware wallet. Requires -signer to be configured. Wallet creation will fail if keys cannot be fetched. Requires disable_private_keys and descriptors set to true.
     
     Result:
    @@ -279,7 +282,7 @@ Unloads the wallet referenced by the request endpoint otherwise unloads the wall
     Specifying the wallet name on a wallet endpoint is invalid.
     Arguments:
     1. wallet_name        (string, optional, default=the wallet name from the RPC endpoint) The name of the wallet to unload. If provided both here and in the RPC endpoint, the two must be identical.
    -2. load_on_startup    (boolean, optional, default=null) Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged.
    +2. load_on_startup    (boolean, optional) Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged.
     
     Result:
     {                       (json object)
    @@ -291,7 +294,7 @@ Examples:
     > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "unloadwallet", "params": [wallet_name]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
     
     === send ===
    -send [{"address":amount},{"data":"hex"},...] ( conf_target "estimate_mode" fee_rate options )
    +send [{"address":amount,...},{"data":"hex"},...] ( conf_target "estimate_mode" fee_rate options )
     
     EXPERIMENTAL warning: this call may be changed in future releases.
     
    @@ -304,6 +307,7 @@ Arguments:
          [
            {                                 (json object)
              "address": amount,              (numeric or string, required) A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in BTC
    +         ...
            },
            {                                 (json object)
              "data": "hex",                  (string, required) A key-value pair. The key must be "data", the value is hex-encoded data
    @@ -378,7 +382,7 @@ Create a transaction that should confirm the next block, with a specific input,
     > bitcoin-cli send '{"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl": 0.1}' 1 economical '{"add_to_wallet": false, "inputs": [{"txid":"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0", "vout":1}]}'
     
     === walletcreatefundedpsbt ===
    -walletcreatefundedpsbt ( [{"txid":"hex","vout":n,"sequence":n},...] ) [{"address":amount},{"data":"hex"},...] ( locktime options bip32derivs )
    +walletcreatefundedpsbt ( [{"txid":"hex","vout":n,"sequence":n},...] ) [{"address":amount,...},{"data":"hex"},...] ( locktime options bip32derivs )
     
     Creates and funds a transaction in the Partially Signed Transaction format.
     Implements the Creator and Updater roles.
    @@ -400,6 +404,7 @@ Arguments:
          [
            {                              (json object)
              "address": amount,           (numeric or string, required) A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in BTC
    +         ...
            },
            {                              (json object)
              "data": "hex",               (string, required) A key-value pair. The key must be "data", the value is hex-encoded data
    
  14. laanwj added this to the "Blockers" column in a project

  15. laanwj commented at 12:25 PM on May 19, 2021: member

    Documentation diff ACK 6e2eb0d63b42288c11a65d585d487108643888d0

  16. fanquake commented at 11:44 PM on May 19, 2021: member

    @MarcoFalke can you have a look here?

  17. MarcoFalke merged this on May 20, 2021
  18. MarcoFalke closed this on May 20, 2021

  19. kallewoof deleted the branch on May 20, 2021
  20. sidhujag referenced this in commit d9eb594fe7 on May 20, 2021
  21. laanwj removed this from the "Blockers" column in a project

  22. gwillen referenced this in commit a9a2cc0c10 on Jun 1, 2022
  23. DrahtBot locked this on Aug 18, 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-04-13 15:14 UTC

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