wallet: rpc: Deprecate encryptwallet RPC for encrypting existing wallets.

bitcoin/bitcoin: PR #36387

2 minor findings · 1 suggestion

Earlier concerns neither republished nor resolved: 3 suggestions. See the Run archive for their assessments.

Findings

Link

[minor] · rpc_deprecated.py loses the default-absence check for iswatchonly

Replacing the unrelated iswatchonly assertion removes functional-test coverage that getaddressinfo omits the field without -deprecatedrpc=iswatchonly.

Location: test/functional/rpc_deprecated.py:41 (base).

Details and suggested fix

getaddressinfo still gates this field on rpcEnableDeprecated("iswatchonly"), but the new encryptwallet check replaces the assertion that exercised its default-off behavior. The remaining check in wallet_descriptor.py enables -deprecatedrpc=iswatchonly and asserts presence, so it would still pass if the field became unconditional. Restore the removed log line and absence assertion alongside the new deprecation check.


Link

[minor] · The new listdescriptors assertions check response keys, not descriptors

Both new no-tprv assertions always pass for the response schema, so they do not test whether the encrypted wallet's public descriptor output contains private-key text.

Location: test/functional/wallet_listdescriptors.py:40 (head).

Details and suggested fix

Iterating over either response dictionary yields only wallet_name and descriptors; neither key contains tprv. The locked/unlocked equality check still catches differences between those states, but the refactor removes the encrypted fixture's explicit expected-public comparison. Compare "tprv" not in d["desc"] for each d in output["descriptors"] instead. The later address comparison cannot replace this check because corresponding public and private descriptors derive the same addresses.


Optional improvements

Link

[suggestion] · Encryption guidance omits the transition and seed-rotation backup caveat

The replacement createwallet example does not protect existing funds, and managing-wallets.md loses a still-relevant seed-rotation warning, although RPC and GUI backup warnings remain.

Location: doc/managing-wallets.md:39 (head).

Details and suggested fix

The example creates a separate wallet, leaving the existing wallet's funds and plaintext keys unchanged. Explain that distinction, tell users to back up the new wallet, and describe transferring funds when moving to fresh keys rather than presenting creation alone as a transition. Such a transfer changes spending conditions and is not equivalent to preserving imported descriptors; old unencrypted backups retain their key material.

Also retain a short warning for in-place encryption through -deprecatedrpc=encryptwallet or the GUI: seed rotation requires a new backup because older backups cannot recover funds received to the new seed. Without that caveat, section 1.5's statement that one backup suffices indefinitely is misleading.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.

Background

Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.

Documented decisions

Rotation conflicts with users' expectation that explicitly imported keys or descriptors remain the wallet's chosen policy. The removal proposal identifies deactivation of custom active descriptors as a hazard; a concrete example is an inheritance arrangement becoming stale. A historical suggestion for imported descriptors was to create a blank encrypted wallet first and import into it.

Migration guidance needs to distinguish protecting key storage from preserving descriptor selection and recovery arrangements. Merely encrypting an existing wallet was not a promise that its future receiving descriptors, shared recovery information, or inheritance setup would remain unchanged.

Source 1 · Source 2 · Source 3 · Source 4