rpc, wallet: Convert walletprocesspsbt to use options parameter #36986

pull jeanpablojp wants to merge 6 commits into bitcoin:master from jeanpablojp:walletprocesspsbt-options changing 9 files +313 −34
  1. jeanpablojp commented at 9:19 PM on November 25, 2026: contributor

    This picks up #24963.

    walletprocesspsbt takes four settings after the PSBT, three of them booleans, so a positional call reads walletprocesspsbt "psbt" true "ALL" true false, and each new setting becomes one more positional parameter (#32857 would add a sixth). This moves the four settings into an options object as the second parameter. Calls that work today, by position or by name, keep working.

    For the old positional form, the second position accepts either the options object or the old sign boolean, which needs a parameter to declare one type per alias. The other three settings stay as hidden positional parameters. A parameter passed by name must have the type declared for that name, so options=true is rejected instead of being read as sign=true.

    Changes compared to #24963, besides the rebase on the current RPC framework.

    • getopenrpcinfo describes the second parameter as an object or a boolean.
    • A call mixing positional and named arguments, such as walletprocesspsbt <psbt> true finalize=false with -named, works as on master instead of failing with "specified twice".
    • The type check by name no longer reads the wrong name after an options object built from named options, which made walletcreatefundedpsbt outputs=... add_inputs=true bip32derivs=false fail with "JSON value of type object is not of expected type object".
    • A null option means the default, as a null named argument does on master.
    • From review on #24963, the options are checked before the wallet sync and the PSBT decode, and a test mixes positional and named arguments.
    • Unit tests for the framework changes.

    descriptorprocesspsbt and createwallet I will do as follow-ups if this is accepted first.

  2. rpc: Support different types for param aliases
    An RPC parameter can have aliases but only one type. Let it declare a
    type per alias, so that one position can take a new options object
    under one name and the old boolean under another. Replacing positional
    parameters with an options object without breaking existing callers
    needs this.
    
    MatchesType accepts any of the declared types, and GetArgMap lists each
    alias with its own type, so the client conversion table is checked per
    name.
    
    Co-authored-by: jeanpablojp <me@jeanpablo.jp>
    2499edf391
  3. rpc: Describe all types of a param in OpenRPC
    getopenrpcinfo builds the schema of a parameter from its first type
    only, so a parameter that takes an options object or a boolean would be
    described as an object. Describe it with a oneOf holding one schema per
    declared type.
    60cf5faf1a
  4. rpc: Keep mixed positional and named calls working
    A named-only option that a positional parameter also accepts by name
    (also_positional) always goes into the options object. When positional
    arguments passed in "args" already take the position of that object,
    the call fails with "specified twice", although the option could go to
    the positional parameter of the same name. Pass it there instead.
    
    No RPC has this layout yet. The next commit gives walletprocesspsbt
    one, and without this change a call such as
    `walletprocesspsbt <psbt> true finalize=false` with -named, which works
    today, would start to fail.
    c3db835afd
  5. rpc, wallet: Convert walletprocesspsbt to options
    Move sign, sighashtype, bip32derivs and finalize into an options object
    as the second parameter, so that new settings do not have to become
    more positional parameters.
    
    Existing calls keep working. The second position still accepts the sign
    boolean, sighashtype, bip32derivs and finalize stay as hidden positional
    parameters, and all four can still be passed by name. A null option
    means the default, as a null named argument did before.
    
    The options are read before waiting for the wallet to sync and decoding
    the PSBT, so invalid options are reported first. The conversion check
    in rpc_help.py compares sets now, because sign is listed at position 1
    both as an option and as an alias.
    
    Co-authored-by: jeanpablojp <me@jeanpablo.jp>
    d24c8ea83d
  6. rpc: Enforce the declared type of named params
    A parameter passed by name must have the type declared for that name,
    so walletprocesspsbt rejects options=true instead of reading it as
    sign=true. A parameter passed by position can still have any of its
    declared types.
    
    transformNamedArguments records the name each parameter was passed
    under. Holes and an options object built from named options get no
    name, so the parameters after them keep their own.
    
    Co-authored-by: jeanpablojp <me@jeanpablo.jp>
    54023e9325
  7. test: Check walletprocesspsbt option errors
    Cover options passed by name with the wrong type, an options field with
    the wrong type, an unknown option, and an options object followed by
    more positional parameters.
    
    Co-authored-by: jeanpablojp <me@jeanpablo.jp>
    348688bb8f
  8. DrahtBot commented at 9:19 PM on November 25, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36154 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36154.svg"></sub> (wallet: fill PSBT_GLOBAL_XPUB by jeanpablojp)
    • #36122 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36122.svg"></sub> (BIP460: CISA for Taproot key path spends by fjahr)
    • #32857 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/32857.svg"></sub> (wallet: allow skipping script paths by Sjors)

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

    LLM Linter (✨ experimental)

    Possible places where comparison-specific test macros should replace generic comparisons:

    • src/test/rpc_tests.cpp: BOOST_CHECK_THROW((RPCArg{"options", ...}), NonFatalCheckError) → Prefer BOOST_CHECK_EXCEPTION with a predicate checking the specific failure message.
    • src/test/rpc_tests.cpp: BOOST_CHECK_THROW((RPCArg{"flag|options", ...}), NonFatalCheckError) → Prefer BOOST_CHECK_EXCEPTION with a predicate checking the specific failure message.

    <sup>2026-11-25 21:19:36</sup>


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-12-01 02:51 UTC

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