rpc: Deprecate watchonly wallet no-op named options #36855

Manually merged
maflcko merged 3 commits from 2611-rpc-wallet-deprecate-watchonly-options into master 2026-12-02 10:29:39 +00:00 AGit
maflcko commented 2026-11-13 15:09:58 +00:00 (Migrated from github.com)

Since "leet" commit 1337c72198, the options are deprecated no-ops, so it seems time to properly start a deprecation cycle for them.

Since "leet" commit 1337c72198a7d32935431d64e9e58c12f9003abc, the options are deprecated no-ops, so it seems time to properly start a deprecation cycle for them.
DrahtBot commented 2026-11-13 15:10:08 +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.

Type Reviewers
ACK enessubass, seduless, willcl-ark

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

No conflicts as of last run.

<!--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/36855 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36855.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36855#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. | Type | Reviewers | | ---- | --------- | | ACK | [enessubass](https://github.com/bitcoin/bitcoin/pull/36855#pullrequestreview-6058950581), [seduless](https://github.com/bitcoin/bitcoin/pull/36855#pullrequestreview-6136213681), [willcl-ark](https://github.com/bitcoin/bitcoin/pull/36855#pullrequestreview-6139043898) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts No conflicts as of last run. <!--5faf32d7da4f0f540f40219e4f7537a3-->
maflcko commented 2026-11-13 15:19:39 +00:00 (Migrated from github.com)

For reference, the positional ones are tedious to deprecate, so that can be done later, maybe via OBJ_NAMED_PARAMS, if possible, but that will be a larger breaking change than this, so I'll leave it for later.

For reference, the positional ones are tedious to deprecate, so that can be done later, maybe via `OBJ_NAMED_PARAMS`, if possible, but that will be a larger breaking change than this, so I'll leave it for later. <!-- ```diff diff --git a/test/functional/wallet_balance.py b/test/functional/wallet_balance.py index 2d36291..f77f9ed 100755 --- a/test/functional/wallet_balance.py +++ b/test/functional/wallet_balance.py @@ -85,3 +85,3 @@ class WalletTest(BitcoinTestFramework): assert_equal(self.nodes[0].getbalance(minconf=0), 50) - assert_equal(self.nodes[0].getbalance("*", 1, True), 50) + assert_equal(self.nodes[0].getbalance(dummy="*", minconf=1, include_watchonly=True), 50) assert_equal(self.nodes[1].getbalance(minconf=0), 50) diff --git a/test/functional/wallet_listreceivedby.py b/test/functional/wallet_listreceivedby.py index 3a6a6df..7251576 100755 --- a/test/functional/wallet_listreceivedby.py +++ b/test/functional/wallet_listreceivedby.py @@ -78,3 +78,3 @@ class ReceivedByTest(BitcoinTestFramework): # Another address receive money - res = self.nodes[1].listreceivedbyaddress(0, True, True) + res = self.nodes[1].listreceivedbyaddress(minconf=0, include_empty=True, include_watchonly=True) assert_equal(len(res), 2 + num_cb_reward_addresses) # Right now 2 entries @@ -85,3 +85,3 @@ class ReceivedByTest(BitcoinTestFramework): expected = {"address": addr, "label": "", "amount": Decimal("0.1"), "confirmations": 11, "txids": [txid, ]} - res = self.nodes[1].listreceivedbyaddress(0, True, True, addr) + res = self.nodes[1].listreceivedbyaddress(minconf=0, include_empty=True, include_watchonly=True, address_filter=addr) assert_array_result(res, {"address": addr}, expected) @@ -90,3 +90,3 @@ class ReceivedByTest(BitcoinTestFramework): expected = {"address": other_addr, "label": "", "amount": Decimal("0.1"), "confirmations": 1, "txids": [txid2, ]} - res = self.nodes[1].listreceivedbyaddress(0, True, True, other_addr) + res = self.nodes[1].listreceivedbyaddress(minconf=0, include_empty=True, include_watchonly=True, address_filter=other_addr) assert_array_result(res, {"address": other_addr}, expected) @@ -94,3 +94,3 @@ class ReceivedByTest(BitcoinTestFramework): # Should be two entries though without filter - res = self.nodes[1].listreceivedbyaddress(0, True, True) + res = self.nodes[1].listreceivedbyaddress(minconf=0, include_empty=True, include_watchonly=True) assert_equal(len(res), 3 + num_cb_reward_addresses) # Became 3 entries @@ -99,3 +99,3 @@ class ReceivedByTest(BitcoinTestFramework): other_addr = self.nodes[0].getnewaddress() # note on node[0]! just a random addr - res = self.nodes[1].listreceivedbyaddress(0, True, True, other_addr) + res = self.nodes[1].listreceivedbyaddress(minconf=0, include_empty=True, include_watchonly=True, address_filter=other_addr) assert_equal(len(res), 0) ``` • ### Flag Use one value, -deprecatedrpc=watchonly, for the six RPCs. With it, accept their legacy positional signatures. Without it, reject those signatures with a deprecation error. The new options forms work either way. ### RPC arguments RPC Legacy positional arguments, in order New form ━━━━━━━━━━━━━━━━━━━━━━━ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ getbalance dummy?, minconf, include_watchonly, avoid_reuse options={minconf, avoid_reuse} ─────────────────────── ────────────────────────────────────────────────────────────────────────────────────────────── ──────────────────────────────────────────────────────────────────────────────────── listreceivedbyaddress minconf, include_empty, include_watchonly, address_filter?, include_immature_coinbase options={minconf, include_empty, address_filter, include_immature_coinbase} ─────────────────────── ────────────────────────────────────────────────────────────────────────────────────────────── ──────────────────────────────────────────────────────────────────────────────────── listreceivedbylabel minconf, include_empty, include_watchonly, include_immature_coinbase options={minconf, include_empty, include_immature_coinbase} ─────────────────────── ────────────────────────────────────────────────────────────────────────────────────────────── ──────────────────────────────────────────────────────────────────────────────────── listtransactions label?, count, skip, include_watchonly label?, options={count, skip} ─────────────────────── ────────────────────────────────────────────────────────────────────────────────────────────── ──────────────────────────────────────────────────────────────────────────────────── listsinceblock blockhash?, target_confirmations, include_watchonly, include_removed, include_change, label? blockhash?, options={target_confirmations, include_removed, include_change, label} ─────────────────────── ────────────────────────────────────────────────────────────────────────────────────────────── ──────────────────────────────────────────────────────────────────────────────────── gettransaction txid, include_watchonly, verbose txid, options={verbose} ### Proposed parsing approach Keep OBJ_NAMED_PARAMS for the new options, with skip_type_check on the options argument so the positional parser can also receive the old scalar at that position. Add optional trailing legacy slots so the RPC’s fixed argument-count check accepts old calls. In each RPC, distinguish an options object from a legacy scalar; gate the legacy path with rpcEnableDeprecated("watchonly"), validate its old arguments, ignore include_watchonly, and use the remaining values in their old positions. Named parameters should still be collected into the options object by OBJ_NAMED_PARAMS. Deprecated named fields such as include_watchonly would need to remain in metadata for conversion and be gated in the handler. The hidden legacy slots need care because the current named-argument mapping also sees hidden arguments; this approach is a sketch that would need a focused implementation check.
First-time contributor

Review failed because required verification did not complete.

Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive linked from the Review report for their assessments.

Review coverage was incomplete.


Reviewed: faab663f38ac · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:806938d40e279b6d701b2e78128bb1a09b55193a0b697245a1dce6241d3081c1:3607c760b63c01fb7f1f349adfc3fd0614b148a7df02e42f2f0edc2d448925a1 --> <!-- ralph-base:edcac28380bbb8409988583b9f1ab32c41f52cac --> <!-- ralph-head:faab663f38ac6b79ec2f631f308fc86053ba9e05 --> <!-- ralph-case:15ea92242e1c9f43f0ae31b63686c6a609ff74da590c3225b3dac1fcf378c2ab --> Review failed because required verification did not complete. Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive linked from the Review report for their assessments. Review coverage was incomplete. <!-- Review tier: standard --> --- Reviewed: [`faab663f38ac`](<https://git.fish.foo/bitcoin/bitcoin/commit/faab663f38ac6b79ec2f631f308fc86053ba9e05>) · [Review report](<https://review.fish.foo/report/36855-faab663f38ac6b79ec2f631f308fc86053ba9e05-3109-4.html>) · [Previous reports](<https://review.fish.foo/traces/36855/>) [permalink](<https://review.fish.foo/report/36855-faab663f38ac6b79ec2f631f308fc86053ba9e05-3109-4.html>)
seduless (Migrated from github.com) reviewed 2026-11-14 21:39:35 +00:00
seduless (Migrated from github.com) left a comment

Tested ACK fa73a095dc

Verified locally that all five RPCs with the -deprecatedrpc=watchonly flag accept their deprecated options.

Tested ACK fa73a095dc6920f83f9ea248c5e44dfd5a0a373a Verified locally that all five RPCs with the `-deprecatedrpc=watchonly` flag accept their deprecated options.
maflcko commented 2026-11-23 07:47:48 +00:00 (Migrated from github.com)

rebased to include two small unrelated deprecation cleanups

rebased to include two small unrelated deprecation cleanups
willcl-ark (Migrated from github.com) approved these changes 2026-11-23 12:01:54 +00:00
willcl-ark (Migrated from github.com) left a comment

ACK fa0d856ab0

This looks good to me.

I'm curious what the future plan might be for the positionals? Move all remaining into an options object? or require them to be null? Something else I didn't think of...

ACK fa0d856ab04ded024b940977945eb81eada522cf This looks good to me. I'm curious what the future plan might be for the positionals? Move all remaining into an options object? or require them to be `null`? Something else I didn't think of...
seduless (Migrated from github.com) reviewed 2026-11-24 23:15:09 +00:00
seduless (Migrated from github.com) left a comment

re-ACK fa0d856ab0

re-ACK fa0d856ab04ded024b940977945eb81eada522cf
seduless (Migrated from github.com) commented 2026-11-24 23:14:35 +00:00

Not a problem for this PR, but if this becomes a template for future deprecations this won't give any notice to consumers that pass a null value. Perhaps !options.exists(option_name) is a more robust template?

Not a problem for this PR, but if this becomes a template for future deprecations this won't give any notice to consumers that pass a `null` value. Perhaps `!options.exists(option_name)` is a more robust template?
maflcko (Migrated from github.com) reviewed 2026-11-25 08:20:56 +00:00
maflcko (Migrated from github.com) commented 2026-11-25 08:20:56 +00:00

Thx, added the missing warning for None as well.

Thx, added the missing warning for `None` as well.
fanquake commented 2026-11-25 08:57:22 +00:00 (Migrated from github.com)

https://github.com/bitcoin/bitcoin/actions/runs/45575314984/job/139071697774?pr=36855#step:11:4543:

                                   AssertionError: Expected substring not found in error message:
                                   substring: 'deprecated no-op option'
                                   error message: 'Insufficient funds'.
https://github.com/bitcoin/bitcoin/actions/runs/45575314984/job/139071697774?pr=36855#step:11:4543: ```bash AssertionError: Expected substring not found in error message: substring: 'deprecated no-op option' error message: 'Insufficient funds'. ```
maflcko (Migrated from github.com) reviewed 2026-11-25 09:37:55 +00:00
maflcko (Migrated from github.com) commented 2026-11-25 09:37:55 +00:00

(Also added test coverage, including for the cli with a small string hack)

(Also added test coverage, including for the cli with a small string hack)
enessubass (Migrated from github.com) reviewed 2026-11-25 13:58:16 +00:00
enessubass (Migrated from github.com) left a comment

ACK faab663f38

Reviewed the 3 commits, checked remaining watch occurrences under src/wallet/rpc/ (only positional ones remain), and built/tested on macOS arm64: rpc_deprecated.py (including --usecli for the named_null None -> "null" handling), wallet_simulaterawtx.py (--usecli), wallet_importprunedfunds.py, wallet_fundrawtransaction.py, wallet_send.py, and wallet_sendall.py all pass.

(AI policy disclosure: used an AI assistant to run the local build and functional test matrix; I reviewed the diff directly.)

ACK faab663f38ac6b79ec2f631f308fc86053ba9e05 Reviewed the 3 commits, checked remaining `watch` occurrences under `src/wallet/rpc/` (only positional ones remain), and built/tested on macOS `arm64`: `rpc_deprecated.py` (including `--usecli` for the `named_null` `None` -> `"null"` handling), `wallet_simulaterawtx.py` (`--usecli`), `wallet_importprunedfunds.py`, `wallet_fundrawtransaction.py`, `wallet_send.py`, and `wallet_sendall.py` all pass. *(AI policy disclosure: used an AI assistant to run the local build and functional test matrix; I reviewed the diff directly.)*
maflcko commented 2026-11-25 15:19:15 +00:00 (Migrated from github.com)

@enessubass Thx, but for the future, there is no need to list the test files and whether they passed. All automated tests are already run automatically and must pass.

@enessubass Thx, but for the future, there is no need to list the test files and whether they passed. All automated tests are already run automatically and must pass.
seduless (Migrated from github.com) reviewed 2026-12-01 17:12:28 +00:00
seduless (Migrated from github.com) left a comment

re-ACK faab663f38

Latest push cleanly addresses the feedback re: null value deprecation warnings.

re-ACK faab663f38ac6b79ec2f631f308fc86053ba9e05 Latest push cleanly addresses the [feedback](https://github.com/bitcoin/bitcoin/pull/36855#discussion_r4687838380) re: null value deprecation warnings.
willcl-ark (Migrated from github.com) approved these changes 2026-12-01 20:01:27 +00:00
willcl-ark (Migrated from github.com) left a comment

reACK faab663f38

reACK faab663f38ac6b79ec2f631f308fc86053ba9e05
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!36855
No description provided.