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

Open
jeanpablojp wants to merge 6 commits from walletprocesspsbt-options into master AGit
jeanpablojp commented 2026-11-25 21:19:09 +00:00 (Migrated from github.com)

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.

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.
DrahtBot commented 2026-11-25 21:19:20 +00:00 (Migrated from github.com)

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

External sites

Reviews

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #37016 (rpc: fail scanblocks instead of silently skipping missing filters by shivansh023023)
  • #36154 (wallet: fill PSBT_GLOBAL_XPUB by jeanpablojp)
  • #36122 (BIP460: CISA for Taproot key path spends by fjahr)
  • #32857 (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.

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.

2026-11-25 21:19:36

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36986 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36986.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36986#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. A summary of reviews will appear here. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts Reviewers, this pull request conflicts with the following ones: * [#37016](https://github.com/bitcoin/bitcoin/pull/37016) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/37016.svg"></sub> (rpc: fail scanblocks instead of silently skipping missing filters by shivansh023023) * [#36154](https://github.com/bitcoin/bitcoin/pull/36154) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36154.svg"></sub> (wallet: fill PSBT_GLOBAL_XPUB by jeanpablojp) * [#36122](https://github.com/bitcoin/bitcoin/pull/36122) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36122.svg"></sub> (BIP460: CISA for Taproot key path spends by fjahr) * [#32857](https://github.com/bitcoin/bitcoin/pull/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>
First-time contributor

🔵 Suggestion · The null finalize test cannot distinguish the default from false

The new finalize=None assertion uses an unsigned PSBT with sign=False, so treating null as false would leave the assertion passing.

Location: test/functional/rpc_psbt.py:1519 (head).

🔵 Suggestion · The OpenRPC schema permits a boolean under options

An OpenRPC client using named arguments can validate options=true against the published schema even though walletprocesspsbt rejects it.

Location: src/rpc/server.cpp:359 (head).

🔵 Suggestion · The walletprocesspsbt interface change lacks a release note

walletprocesspsbt now documents an options object and hides the legacy positional settings, but no release-note entry explains the change.

Location: src/wallet/rpc/spend.cpp:1640 (head).

🔵 Suggestion · The conversion commit precedes its by-name type enforcement

The final tree rejects options=<bool>, but the conversion commit temporarily accepts it as sign; moving the framework check earlier would make the conversion independently reviewable with its intended contract.

Location: src/wallet/rpc/spend.cpp:1640 (commit).


Reviewed: 348688bb8fd2 · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:806938d40e279b6d701b2e78128bb1a09b55193a0b697245a1dce6241d3081c1:3607c760b63c01fb7f1f349adfc3fd0614b148a7df02e42f2f0edc2d448925a1 --> <!-- ralph-base:0e8f70a86314bc73539b110d947c41d40c4886fc --> <!-- ralph-head:348688bb8fd2179ccaa7637f11fd044d60a5a4c1 --> <!-- ralph-case:f8be2d062d567b791beb75f0325c8efa312ef0d1e28d7300ee02eb680be09719 --> **🔵 Suggestion · The null `finalize` test cannot distinguish the default from `false`** The new `finalize=None` assertion uses an unsigned PSBT with `sign=False`, so treating null as false would leave the assertion passing. Location: [`test/functional/rpc_psbt.py:1519`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/348688bb8fd2179ccaa7637f11fd044d60a5a4c1/test/functional/rpc_psbt.py#L1519>) (head). **🔵 Suggestion · The OpenRPC schema permits a boolean under `options`** An OpenRPC client using named arguments can validate `options=true` against the published schema even though `walletprocesspsbt` rejects it. Location: [`src/rpc/server.cpp:359`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/348688bb8fd2179ccaa7637f11fd044d60a5a4c1/src/rpc/server.cpp#L359>) (head). **🔵 Suggestion · The `walletprocesspsbt` interface change lacks a release note** `walletprocesspsbt` now documents an options object and hides the legacy positional settings, but no release-note entry explains the change. Location: [`src/wallet/rpc/spend.cpp:1640`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/348688bb8fd2179ccaa7637f11fd044d60a5a4c1/src/wallet/rpc/spend.cpp#L1640>) (head). **🔵 Suggestion · The conversion commit precedes its by-name type enforcement** The final tree rejects `options=<bool>`, but the conversion commit temporarily accepts it as `sign`; moving the framework check earlier would make the conversion independently reviewable with its intended contract. Location: src/wallet/rpc/spend.cpp:1640 (commit). <!-- Review tier: sensitive --> --- Reviewed: [`348688bb8fd2`](<https://git.fish.foo/bitcoin/bitcoin/commit/348688bb8fd2179ccaa7637f11fd044d60a5a4c1>) · [Review report](<https://review.fish.foo/report/36986-348688bb8fd2179ccaa7637f11fd044d60a5a4c1-3153-1.html>) · [Previous reports](<https://review.fish.foo/traces/36986/>) [permalink](<https://review.fish.foo/report/36986-348688bb8fd2179ccaa7637f11fd044d60a5a4c1-3153-1.html>)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36986
No description provided.