mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:50:37 +00:00
wallet: rpc: Deprecate encryptwallet RPC for encrypting existing wallets. #36387
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36387
Loading…
Reference in a new issue
No description provided.
Delete branch "2026-09-29-deprecate-encryptwallet"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
For more context, see: #36027
Encrypting existing wallets that are unencrypted is fraught with footguns and complexity both for users and for developers.
For example:
No efforts are made to ensure that remnants of unencrypted key material are not left on the user's disk, as attempting to ensure this would be difficult and dangerous, and for some SSD's infeasible.
Encrypting a wallet that has manually imported descriptors will cause the wallet to change the spending conditions out from under the user. (https://github.com/bitcoin/bitcoin/issues/26607)
Because new keys are made after encryption, restoring from a backup made before encryption may result in loss of funds.
LLM Disclosure: Used gemma4-26B and qwen3.8-next-flash as research and drafting tools, but all code and text present here were written by me.
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.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, 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 typos and grammar issues:
doc/managing-wallets.md:accompolished→accomplished[misspelling]Possible places where named args for integral literals may be used (e.g.
func(x, /*named_arg=*/0)in C++, andfunc(x, named_arg=0)in Python):test/functional/test_framework/test_framework.py:wallet_importprivkey(n.get_wallet_rpc(wallet_name), n.get_deterministic_priv_key().key, 0, label="coinbase")test/functional/test_framework/test_framework.py:wallet_importprivkey(n.get_wallet_rpc(wallet_name), n.get_deterministic_priv_key().key, 0, label="coinbase")2026-11-19 20:42:56
Earlier concerns remain unresolved; see the Run archive linked from the Review report.
🟠 Minor ·
rpc_deprecated.pyloses the default-absence check foriswatchonlyReplacing the unrelated
iswatchonlyassertion removes functional-test coverage thatgetaddressinfoomits the field without-deprecatedrpc=iswatchonly.Location:
test/functional/rpc_deprecated.py:41(base).🟠 Minor · The new
listdescriptorsassertions check response keys, not descriptorsBoth new no-
tprvassertions 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).🔵 Suggestion · Encryption guidance omits the transition and seed-rotation backup caveat
The replacement
createwalletexample does not protect existing funds, andmanaging-wallets.mdloses a still-relevant seed-rotation warning, although RPC and GUI backup warnings remain.Location:
doc/managing-wallets.md:39(head).Review coverage was incomplete.
Reviewed:
820120eb466f· Review report · Previous reportspermalink
Concept ACK, will review when I get a chance.
Concept ACK
Concept ACK
I think
encryptwalletRPC was created before thecreatewallletgained thepassphrase, and for what it worth creating today a new encrypted wallet and sendall-ing to it is equivalent and cleaner.The GUI "Encrypt Wallet…" action (
WalletView::encryptWallet→interfaces::Wallet::encryptWallet) is unaffected and is probably where most users hit this. It might be worth mentioning in the description and release notes so the GUI and RPC deprecations ship in the same release (?).Left some nits.
nit: filename convention is
release-notes-36387.md.nit (for consistency with the
removeprunedfundscheck above)...nit: extra blank line here.
nit: the two branches only differ in the passphrase and the unlock around the import, so they could perhaps be collapsed. Also
wis assigned but thenget_wallet_rpcis called again forwallet_importprivkey, sowcould be reused there.Since this drops the
if wallet_name is not None:check, thewallet_namescomment could also drop "If wallet names are None, wallet creation is skipped.". That case has been broken since #32452 (fcc457573f) anyway (get_wallet_rpc(None)would rase inurllib.parse.quote).(needs import contextlib; tested on top of
2cc0946985with the full extended functional suite.)nit:
nit: extra blank line here.
nit: extra blank line here.
nit: import block indented 8 spaces (and missing trailing comma after
generate_keypair).nit: the previous version of the test compared the private output against
expected_privateand now the wallet is left unlocked until its unload.nit: extra blank line here.
Concept ACK
In
2587fe96a8"refactor: test: rpc_psbt.py extract encrypted wallet signing"This logging is unnecessary.
As we've discussed elsewhere, the main purpose of that convention/recommendation is to avoid naming collisions, but it has the downside that it also requires the PR to be opened before the release note can be made. I think it's a matter of preference which I feel a bit stubbornly about so I'll mark this as resolved.
Thanks for the suggestion, while your version is shorter, I think the current approach is more simple and legible, stylistic choice, but if you are insistent I'll change it.
Logging it is better than a code comment IMO since it makes it easier to figure out the test case that failed, and this is a convention used a lot elsewhere in functional tests, e.g.:
github.com/bitcoin/bitcoin@94181c18e2/test/functional/rpc_openrpc.py (L46-L66)github.com/bitcoin/bitcoin@94181c18e2/test/functional/p2p_addrv2_relay.py (L78-L109)github.com/bitcoin/bitcoin@94181c18e2/test/functional/feature_asmap.py (L92-L110)Thanks, taken!
taken
I dropped this coverage deliberately since it seemed kind of redundant to me, but I guess in theory listdescriptors private=true could work for unencrypted wallets but be broken for encrypted wallets and output incorrect stuff, even though that's unlikely, so taken, thanks for the approach.
Thanks for catching, fixed.
Thanks, fixed.
Thanks, fixed.
Thanks, fixed.
thanks, fixed.
Pushed to address reviewer feedback.
ACK
854abafabeACK
854abafabeACK
854abafabeSilent merge conflict I guess:
Not sure about the rest of the formatting, but can you add the missing
(#36387):See #36773 for context.
Maybe a trailing comment can be added to avoid those in the future?
Edit: Also, this should be updated to require the
-deprecatedrpctoggle or be reworded?Pushed a rebase to fix the silent merge conflict and address reviewer feedback.
managing-wallets.mdfile to not recommendencryptwalletThanks for pointing this out, fixed.
Concept ACK https://github.com/bitcoin/bitcoin/pull/36387/commits/a06ba1f5c883a8f451cfe7935831e9be8634e20c:
Some modified tests, like
wallet_multiwallet.py, indirectly testedencryptwalletpersistence by unloading the encrypted wallet and reloading it. None of the current functional tests does this, so we lose that coverage on the now-deprecatedencryptwalletRPC. A natural location for a test like this iswallet_encryption.py, which will be deleted whenencryptwalletis deleted.Good catch, thanks for the suggestion, I've pushed to add a check that the wallet is still encrypted after reloading in the sasme commit where I change
wallet_multiwallet.py:Sorry for the noise, made the change to a stale branch on a different machine.
🐙 This pull request conflicts with the target branch and needs rebase.
reACK
8833e3e13fACK https://github.com/bitcoin/bitcoin/pull/36387/commits/8833e3e13fca1bbc80db53107e31e23855a650aa
🐙 This pull request conflicts with the target branch and needs rebase.
Pushed a rebase to fix merge conflict.
reACK
820120eb46ACK
820120eb46