Repository navigation
rpc, wallet: Convert walletprocesspsbt to use options parameter - #36986
Open
jeanpablojp wants to merge 6 commits into
Open
jeanpablojp wants to merge 6 commits into
jeanpablojp wants to merge 6 commits into
Conversation
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 <[email protected]>
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.
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.
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
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. LLM Linter (✨ experimental)Possible places where comparison-specific test macros should replace generic comparisons:
2026-11-25 21:19:36 |
This was referenced Nov 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This picks up #24963.
walletprocesspsbttakes four settings after the PSBT, three of them booleans, so a positional call readswalletprocesspsbt "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
signboolean, 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, sooptions=trueis rejected instead of being read assign=true.Changes compared to #24963, besides the rebase on the current RPC framework.
getopenrpcinfodescribes the second parameter as an object or a boolean.walletprocesspsbt <psbt> true finalize=falsewith-named, works as on master instead of failing with "specified twice".walletcreatefundedpsbt outputs=... add_inputs=true bip32derivs=falsefail with "JSON value of type object is not of expected type object".descriptorprocesspsbtandcreatewalletI will do as follow-ups if this is accepted first.