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

bitcoin/bitcoin: PR #36387

1 major finding · 1 minor finding · 1 suggestion

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

Findings

Link

[major] · Deprecation test uses a wallet that is never created

In wallet-enabled builds, the new assertion gets -18 before the deprecation gate instead of -32; the supplied experiment reproduced this test failure, leaving the default-off behavior untested.

Location: test/functional/rpc_deprecated.py:33 (head).

Details and suggested fix

uses_wallet = None makes setup_nodes() skip wallet creation, and get_wallet_rpc("ancient_wallet") only constructs a wallet-specific endpoint. When the assertion calls encryptwallet, GetWalletForJSONRPCRequest() throws RPC_WALLET_NOT_FOUND with "Requested wallet does not exist or is not loaded" before reaching rpcEnableDeprecated("encryptwallet"). Create the fixture with self.nodes[0].createwallet("ancient_wallet") before obtaining its endpoint so the existing assertion reaches the intended -32 error.


Link

[minor] · The no-tprv assertions inspect dictionary keys

The encrypted-wallet test's two no-tprv assertions inspect only response keys, so neither checks whether descriptor strings contain private keys.

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

Details and suggested fix

listdescriptors() returns a dictionary with wallet_name and descriptors, so both comprehensions pass regardless of the descriptor contents. Locked/unlocked equality only catches differences between those responses, and private and public descriptors can derive the same addresses. Check d["desc"] within each response's "descriptors" array instead, for example assert all("tprv" not in d["desc"] for d in encrypted_locked_output["descriptors"]), and apply the same change to the unlocked response.


Optional improvements

Link

[suggestion] · Wallet guide still recommends the now-disabled RPC

The unchanged wallet guide recommends an encryptwallet command the new guard rejects by default, without documenting the opt-in or a transition for funded unencrypted wallets.

Location: doc/release-notes-deprecateencryptwallet.md:4 (head).

Details and suggested fix

doc/managing-wallets.md §1.2 still presents bitcoin-cli -rpcwallet="wallet-01" encryptwallet "passphrase" as the encryption command. It now returns -32 unless the node starts with -deprecatedrpc=encryptwallet. Update that section to lead with createwallet's passphrase argument and mark in-place encryption as deprecated with its required opt-in, retaining the immediate-new-backup warning. Link guidance from this release note for existing-wallet users to create an encrypted wallet, move funds, and back up the new wallet. If that procedure uses sendall, explain that it excludes locked UTXOs and unconfirmed inbound UTXOs, so a successful send alone does not establish that the old wallet is empty.


Coverage details

Earlier concerns

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