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

Manually merged
davidgumberg merged 8 commits from 2026-09-29-deprecate-encryptwallet into master 2026-11-20 22:00:13 +00:00 AGit
davidgumberg commented 2026-09-30 02:11:05 +00:00 (Migrated from github.com)

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.

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._
DrahtBot commented 2026-09-30 02:11:13 +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 w0xlt, achow101
Concept ACK pseudoramdom, rkrux
Stale ACK pablomartin4btc, Eunovo

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:

  • #36796 (wallet, sqlite: Enable secure_delete by default by achow101)
  • #36577 (psbt: check sig sighash only if a type is given by fametrano)
  • #36257 (qa: assert_equals -> assert_true/assert_false by hodlinator)
  • #33954 (test: add functional test for outbound connection management by mzumsande)

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++, and func(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

<!--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/36387 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36387.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36387#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 | [w0xlt](https://github.com/bitcoin/bitcoin/pull/36387#pullrequestreview-5983716883), [achow101](https://github.com/bitcoin/bitcoin/pull/36387#issuecomment-7051244744) | | Concept ACK | [pseudoramdom](https://github.com/bitcoin/bitcoin/pull/36387#issuecomment-5904400903), [rkrux](https://github.com/bitcoin/bitcoin/pull/36387#issuecomment-6630680564) | | Stale ACK | [pablomartin4btc](https://github.com/bitcoin/bitcoin/pull/36387#pullrequestreview-5791263561), [Eunovo](https://github.com/bitcoin/bitcoin/pull/36387#pullrequestreview-5889457063) | 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 Reviewers, this pull request conflicts with the following ones: * [#36796](https://github.com/bitcoin/bitcoin/pull/36796) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36796.svg"></sub> (wallet, sqlite: Enable secure_delete by default by achow101) * [#36577](https://github.com/bitcoin/bitcoin/pull/36577) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36577.svg"></sub> (psbt: check sig sighash only if a type is given by fametrano) * [#36257](https://github.com/bitcoin/bitcoin/pull/36257) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36257.svg"></sub> (qa: assert_equals -> assert_true/assert_false by hodlinator) * [#33954](https://github.com/bitcoin/bitcoin/pull/33954) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/33954.svg"></sub> (test: add functional test for outbound connection management by mzumsande) 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 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++, and `func(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")` <sup>2026-11-19 20:42:56</sup>
First-time contributor

Earlier concerns remain unresolved; see the Run archive linked from the Review report.

🟠 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).

🟠 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).

🔵 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).

Review coverage was incomplete.


Reviewed: 820120eb466f · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:3705f06c6a27c475c77f2533c4d016ac03c829c839b7b538bba5e4768ccf54f1:1ed10c4979af6fc548d6b8d4534d505e02e84ac4b0aa4f8633555b2ba75119e8 --> <!-- ralph-base:079437cca7a8e2997a6dcd83ad38350014352544 --> <!-- ralph-head:820120eb466ff2242d99f4c77ae6f8fa77f4bc9c --> <!-- ralph-case:59c07b260d94c1bc8d91222ce905d48dc074ea42f4afcb33765516cba3ff1ba5 --> Earlier concerns remain unresolved; see the Run archive linked from the Review report. **🟠 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`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/079437cca7a8e2997a6dcd83ad38350014352544/test/functional/rpc_deprecated.py#L41>) (base). **🟠 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`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/820120eb466ff2242d99f4c77ae6f8fa77f4bc9c/test/functional/wallet_listdescriptors.py#L40>) (head). **🔵 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`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/820120eb466ff2242d99f4c77ae6f8fa77f4bc9c/doc/managing-wallets.md#L39>) (head). Review coverage was incomplete. <!-- Review tier: sensitive --> --- Reviewed: [`820120eb466f`](<https://git.fish.foo/bitcoin/bitcoin/commit/820120eb466ff2242d99f4c77ae6f8fa77f4bc9c>) · [Review report](<https://review.fish.foo/report/36387-820120eb466ff2242d99f4c77ae6f8fa77f4bc9c-2855-9.html>) · [Previous reports](<https://review.fish.foo/traces/36387/>) [permalink](<https://review.fish.foo/report/36387-820120eb466ff2242d99f4c77ae6f8fa77f4bc9c-2855-9.html>)
pseudoramdom commented 2026-09-30 05:00:22 +00:00 (Migrated from github.com)

Concept ACK, will review when I get a chance.

Concept ACK, will review when I get a chance.
w0xlt commented 2026-09-30 17:33:59 +00:00 (Migrated from github.com)

Concept ACK

Concept ACK
pablomartin4btc (Migrated from github.com) reviewed 2026-10-21 01:15:04 +00:00
pablomartin4btc (Migrated from github.com) left a comment

Concept ACK

I think encryptwallet RPC was created before the createwalllet gained the passphrase, 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.

Concept ACK I think `encryptwallet` RPC was created before the `createwalllet` gained the `passphrase`, 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.
pablomartin4btc (Migrated from github.com) commented 2026-10-20 22:36:57 +00:00

nit: filename convention is release-notes-36387.md.

nit: filename [convention](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#release-notes) is `release-notes-36387.md`.
pablomartin4btc (Migrated from github.com) commented 2026-10-21 01:05:29 +00:00

nit (for consistency with the removeprunedfunds check above)...

            self.log.info("Test encryptwallet deprecation")
            assert_raises_rpc_error(
nit (for consistency with the `removeprunedfunds` check above)... ```suggestion self.log.info("Test encryptwallet deprecation") assert_raises_rpc_error( ```
pablomartin4btc (Migrated from github.com) commented 2026-10-20 23:49:08 +00:00

nit: extra blank line here.

nit: extra blank line here.
pablomartin4btc (Migrated from github.com) commented 2026-10-20 23:44:51 +00:00

nit: the two branches only differ in the passphrase and the unlock around the import, so they could perhaps be collapsed. Also w is assigned but then get_wallet_rpc is called again for wallet_importprivkey, so w could be reused there.

Since this drops the if wallet_name is not None: check, the wallet_names comment 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 in urllib.parse.quote).

            passphrase_args = {"passphrase": self.default_wallet_pass} if encrypted else {}
            n.createwallet(wallet_name=wallet_name, load_on_startup=True, **passphrase_args)
            w = n.get_wallet_rpc(wallet_name)
            with WalletUnlock(w, self.default_wallet_pass) if encrypted else contextlib.nullcontext():
                wallet_importprivkey(w, n.get_deterministic_priv_key().key, 0, label="coinbase")                

(needs import contextlib; tested on top of 2cc0946985 with the full extended functional suite.)

nit: the two branches only differ in the passphrase and the unlock around the import, so they could perhaps be collapsed. Also `w` is assigned but then `get_wallet_rpc` is called again for `wallet_importprivkey`, so `w` could be reused there. Since this drops the `if wallet_name is not None:` check, the `wallet_names` [comment](https://github.com/bitcoin/bitcoin/blob/4303f3b7f0775cdbbe77faddf142e1e44fa590ca/test/functional/test_framework/test_framework.py#L121-L122) 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 in `urllib.parse.quote`). ```suggestion passphrase_args = {"passphrase": self.default_wallet_pass} if encrypted else {} n.createwallet(wallet_name=wallet_name, load_on_startup=True, **passphrase_args) w = n.get_wallet_rpc(wallet_name) with WalletUnlock(w, self.default_wallet_pass) if encrypted else contextlib.nullcontext(): wallet_importprivkey(w, n.get_deterministic_priv_key().key, 0, label="coinbase") ``` (needs import contextlib; tested on top of 2cc0946985 with the full extended functional suite.)
pablomartin4btc (Migrated from github.com) commented 2026-10-21 01:03:04 +00:00

nit:

    assert_equal(bumpfee_res["errors"], [])
nit: ```suggestion assert_equal(bumpfee_res["errors"], []) ```
pablomartin4btc (Migrated from github.com) commented 2026-10-20 23:49:51 +00:00

nit: extra blank line here.

nit: extra blank line here.
pablomartin4btc (Migrated from github.com) commented 2026-10-20 23:49:18 +00:00

nit: extra blank line here.

nit: extra blank line here.
pablomartin4btc (Migrated from github.com) commented 2026-10-21 00:06:27 +00:00

nit: import block indented 8 spaces (and missing trailing comma after generate_keypair).

    WalletUnlock,
    generate_keypair,
nit: import block indented 8 spaces (and missing trailing comma after `generate_keypair`). ```suggestion WalletUnlock, generate_keypair, ```
pablomartin4btc (Migrated from github.com) commented 2026-10-21 00:59:03 +00:00

nit: the previous version of the test compared the private output against expected_private and now the wallet is left unlocked until its unload.

         self.log.info("- With private=true, works when unlocked and matches the public descriptors.")
         with WalletUnlock(encrypted_wallet, self.default_wallet_pass):
             private_output = encrypted_wallet.listdescriptors(True)
         public_descs = [d["desc"] for d in encrypted_locked_output["descriptors"]]
         private_descs = [d["desc"] for d in private_output["descriptors"]]
         assert all("tprv" in d for d in private_descs)
         assert_equal([self.nodes[0].deriveaddresses(d, [0, 2]) for d in private_descs],
                      [self.nodes[0].deriveaddresses(d, [0, 2]) for d in public_descs])
nit: the previous version of the test compared the private output against `expected_private` and now the wallet is left unlocked until its unload. ```suggestion self.log.info("- With private=true, works when unlocked and matches the public descriptors.") with WalletUnlock(encrypted_wallet, self.default_wallet_pass): private_output = encrypted_wallet.listdescriptors(True) public_descs = [d["desc"] for d in encrypted_locked_output["descriptors"]] private_descs = [d["desc"] for d in private_output["descriptors"]] assert all("tprv" in d for d in private_descs) assert_equal([self.nodes[0].deriveaddresses(d, [0, 2]) for d in private_descs], [self.nodes[0].deriveaddresses(d, [0, 2]) for d in public_descs]) ```
pablomartin4btc (Migrated from github.com) commented 2026-10-20 23:51:44 +00:00

nit: extra blank line here.

nit: extra blank line here.
rkrux commented 2026-11-04 12:32:22 +00:00 (Migrated from github.com)

Concept ACK

Concept ACK
achow101 (Migrated from github.com) reviewed 2026-11-04 22:10:08 +00:00
achow101 (Migrated from github.com) commented 2026-11-04 22:09:55 +00:00

In 2587fe96a8 "refactor: test: rpc_psbt.py extract encrypted wallet signing"

This logging is unnecessary.

In 2587fe96a8c54a97d2dd9c9d9fcc7d3ceda441b4 "refactor: test: rpc_psbt.py extract encrypted wallet signing" This logging is unnecessary.
davidgumberg (Migrated from github.com) reviewed 2026-11-05 01:56:16 +00:00
davidgumberg (Migrated from github.com) commented 2026-11-05 01:56:16 +00:00

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.

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.
davidgumberg (Migrated from github.com) reviewed 2026-11-05 02:01:02 +00:00
davidgumberg (Migrated from github.com) commented 2026-11-05 02:01:02 +00:00

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.

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.
davidgumberg (Migrated from github.com) reviewed 2026-11-05 02:32:25 +00:00
davidgumberg (Migrated from github.com) commented 2026-11-05 02:32:25 +00:00

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)

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.: https://github.com/bitcoin/bitcoin/blob/94181c18e25436d5e4a2de2ff71714413b4552a2/test/functional/rpc_openrpc.py#L46-L66 https://github.com/bitcoin/bitcoin/blob/94181c18e25436d5e4a2de2ff71714413b4552a2/test/functional/p2p_addrv2_relay.py#L78-L109 https://github.com/bitcoin/bitcoin/blob/94181c18e25436d5e4a2de2ff71714413b4552a2/test/functional/feature_asmap.py#L92-L110
davidgumberg (Migrated from github.com) reviewed 2026-11-05 02:32:59 +00:00
davidgumberg (Migrated from github.com) commented 2026-11-05 02:32:59 +00:00

Thanks, taken!

Thanks, taken!
davidgumberg (Migrated from github.com) reviewed 2026-11-05 02:33:04 +00:00
davidgumberg (Migrated from github.com) commented 2026-11-05 02:33:04 +00:00

taken

taken
davidgumberg (Migrated from github.com) reviewed 2026-11-05 02:33:07 +00:00
davidgumberg (Migrated from github.com) commented 2026-11-05 02:33:07 +00:00

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.

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.
davidgumberg (Migrated from github.com) reviewed 2026-11-05 02:33:16 +00:00
davidgumberg (Migrated from github.com) commented 2026-11-05 02:33:16 +00:00

Thanks for catching, fixed.

Thanks for catching, fixed.
davidgumberg (Migrated from github.com) reviewed 2026-11-05 02:33:21 +00:00
davidgumberg (Migrated from github.com) commented 2026-11-05 02:33:21 +00:00

Thanks, fixed.

Thanks, fixed.
davidgumberg (Migrated from github.com) reviewed 2026-11-05 02:33:25 +00:00
davidgumberg (Migrated from github.com) commented 2026-11-05 02:33:25 +00:00

Thanks, fixed.

Thanks, fixed.
davidgumberg (Migrated from github.com) reviewed 2026-11-05 02:33:30 +00:00
davidgumberg (Migrated from github.com) commented 2026-11-05 02:33:30 +00:00

Thanks, fixed.

Thanks, fixed.
davidgumberg (Migrated from github.com) reviewed 2026-11-05 02:33:35 +00:00
davidgumberg (Migrated from github.com) commented 2026-11-05 02:33:35 +00:00

thanks, fixed.

thanks, fixed.
davidgumberg commented 2026-11-05 02:34:58 +00:00 (Migrated from github.com)

Pushed to address reviewer feedback.

Pushed to address reviewer feedback.
pablomartin4btc (Migrated from github.com) reviewed 2026-11-05 20:02:18 +00:00
pablomartin4btc (Migrated from github.com) left a comment
ACK 854abafabece0b74d77eecac0cba5e4b3f550fb4
achow101 commented 2026-11-05 23:05:22 +00:00 (Migrated from github.com)
ACK 854abafabece0b74d77eecac0cba5e4b3f550fb4
w0xlt (Migrated from github.com) reviewed 2026-11-05 23:22:56 +00:00
w0xlt (Migrated from github.com) left a comment
ACK 854abafabece0b74d77eecac0cba5e4b3f550fb4
achow101 commented 2026-11-06 00:21:10 +00:00 (Migrated from github.com)

Silent merge conflict I guess:

  File "/home/ava/bitcoin/bitcoin/master/clang_RelWithDebInfo/test/functional/rpc_deprecated.py", line 32
    self.log.info("Test encryptwallet deprecation")
IndentationError: unexpected indent
Silent merge conflict I guess: ``` File "/home/ava/bitcoin/bitcoin/master/clang_RelWithDebInfo/test/functional/rpc_deprecated.py", line 32 self.log.info("Test encryptwallet deprecation") IndentationError: unexpected indent ```
fanquake (Migrated from github.com) reviewed 2026-11-06 10:28:59 +00:00
fanquake (Migrated from github.com) commented 2026-11-06 10:28:59 +00:00

Not sure about the rest of the formatting, but can you add the missing (#36387):

- The `encryptwallet` RPC for encrypting an existing wallet that was created as
  an unencrypted wallet has been deprecated and will be removed in a future major
  release. Support for creating encrypted wallets is not going away or being changed,
  it is only encrypting already unencrypted wallets that has footguns for
  users and is being deprecated. In order to continue using `encryptwallet`,
  `bitcoind` must be started with the `-deprecatedrpc=encryptwallet` flag
  set. (#36387)

See #36773 for context.

Not sure about the rest of the formatting, but can you add the missing `(#36387)`: ```suggestion - The `encryptwallet` RPC for encrypting an existing wallet that was created as an unencrypted wallet has been deprecated and will be removed in a future major release. Support for creating encrypted wallets is not going away or being changed, it is only encrypting already unencrypted wallets that has footguns for users and is being deprecated. In order to continue using `encryptwallet`, `bitcoind` must be started with the `-deprecatedrpc=encryptwallet` flag set. (#36387) ``` See #36773 for context.
maflcko commented 2026-11-06 13:54:57 +00:00 (Migrated from github.com)

Silent merge conflict I guess:

  File "/home/ava/bitcoin/bitcoin/master/clang_RelWithDebInfo/test/functional/rpc_deprecated.py", line 32
    self.log.info("Test encryptwallet deprecation")
IndentationError: unexpected indent

Maybe a trailing comment can be added to avoid those in the future?

        if self.is_wallet_compiled():
            self.log.info("Tests for deprecated wallet-related RPC methods (if any)")
            self.nodes[0].createwallet("a_wallet")
            wallet = self.nodes[0].get_wallet_rpc("a_wallet")  # do not remove this boilerplate, even if unused, it will be needed again in the future

Edit: Also, this should be updated to require the -deprecatedrpc toggle or be reworded?

$ git grep encryptwallet
doc/managing-wallets.md:$ bitcoin-cli -rpcwallet="wallet-01" encryptwallet "passphrase"
> Silent merge conflict I guess: > > ``` > File "/home/ava/bitcoin/bitcoin/master/clang_RelWithDebInfo/test/functional/rpc_deprecated.py", line 32 > self.log.info("Test encryptwallet deprecation") > IndentationError: unexpected indent > ``` Maybe a trailing comment can be added to avoid those in the future? ```py if self.is_wallet_compiled(): self.log.info("Tests for deprecated wallet-related RPC methods (if any)") self.nodes[0].createwallet("a_wallet") wallet = self.nodes[0].get_wallet_rpc("a_wallet") # do not remove this boilerplate, even if unused, it will be needed again in the future ``` Edit: Also, this should be updated to require the `-deprecatedrpc` toggle or be reworded? ``` $ git grep encryptwallet doc/managing-wallets.md:$ bitcoin-cli -rpcwallet="wallet-01" encryptwallet "passphrase"
davidgumberg commented 2026-11-07 01:32:07 +00:00 (Migrated from github.com)

Pushed a rebase to fix the silent merge conflict and address reviewer feedback.

  • Added a comment to prevent (some) future silent merge conflicts
  • Fixed the managing-wallets.md file to not recommend encryptwallet
  • Added the PR number to the release notes
Pushed a rebase to fix the silent merge conflict and address reviewer feedback. - Added a comment to prevent (some) future silent merge conflicts - Fixed the `managing-wallets.md` file to not recommend `encryptwallet` - Added the PR number to the release notes
davidgumberg (Migrated from github.com) reviewed 2026-11-07 01:32:14 +00:00
davidgumberg (Migrated from github.com) commented 2026-11-07 01:32:14 +00:00

Thanks for pointing this out, fixed.

Thanks for pointing this out, fixed.
Eunovo (Migrated from github.com) reviewed 2026-11-10 14:41:25 +00:00
Eunovo (Migrated from github.com) left a comment

Concept ACK https://github.com/bitcoin/bitcoin/pull/36387/commits/a06ba1f5c883a8f451cfe7935831e9be8634e20c:

Some modified tests, like wallet_multiwallet.py, indirectly tested encryptwallet persistence by unloading the encrypted wallet and reloading it. None of the current functional tests does this, so we lose that coverage on the now-deprecated encryptwallet RPC. A natural location for a test like this is wallet_encryption.py, which will be deleted when encryptwallet is deleted.

Concept ACK https://github.com/bitcoin/bitcoin/pull/36387/commits/a06ba1f5c883a8f451cfe7935831e9be8634e20c: Some modified tests, like `wallet_multiwallet.py`, indirectly tested `encryptwallet` persistence by unloading the encrypted wallet and reloading it. None of the current functional tests does this, so we lose that coverage on the now-deprecated `encryptwallet` RPC. A natural location for a test like this is `wallet_encryption.py`, which will be deleted when `encryptwallet` is deleted.
davidgumberg commented 2026-11-10 21:12:32 +00:00 (Migrated from github.com)

Some modified tests, like wallet_multiwallet.py, indirectly tested encryptwallet persistence by unloading the encrypted wallet and reloading it. None of the current functional tests does this, so we lose that coverage on the now-deprecated encryptwallet RPC. A natural location for a test like this is wallet_encryption.py, which will be deleted when encryptwallet is 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:

diff --git a/test/functional/wallet_encryption.py b/test/functional/wallet_encryption.py
index 7b5aae7bde..a319868d26 100755
--- a/test/functional/wallet_encryption.py
+++ b/test/functional/wallet_encryption.py
@@ -46,6 +46,11 @@ class WalletEncryptionTest(BitcoinTestFramework):
         assert_raises_rpc_error(-8, "passphrase cannot be empty", self.nodes[0].walletpassphrase, '', 1)
         assert_raises_rpc_error(-8, "passphrase cannot be empty", self.nodes[0].walletpassphrasechange, '', 'ff')
 
+        self.log.info("Test encryptwallet persistence")
+        self.nodes[0].unloadwallet(self.default_wallet_name)
+        self.nodes[0].loadwallet(self.default_wallet_name)
+        assert_raises_rpc_error(-13, "Please enter the wallet passphrase with walletpassphrase first", self.nodes[0].signmessage, address, msg)
+
         # Check that walletpassphrase works
         self.nodes[0].walletpassphrase(passphrase, 2)
> Some modified tests, like `wallet_multiwallet.py`, indirectly tested `encryptwallet` persistence by unloading the encrypted wallet and reloading it. None of the current functional tests does this, so we lose that coverage on the now-deprecated `encryptwallet` RPC. A natural location for a test like this is `wallet_encryption.py`, which will be deleted when `encryptwallet` is 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`: ```diff diff --git a/test/functional/wallet_encryption.py b/test/functional/wallet_encryption.py index 7b5aae7bde..a319868d26 100755 --- a/test/functional/wallet_encryption.py +++ b/test/functional/wallet_encryption.py @@ -46,6 +46,11 @@ class WalletEncryptionTest(BitcoinTestFramework): assert_raises_rpc_error(-8, "passphrase cannot be empty", self.nodes[0].walletpassphrase, '', 1) assert_raises_rpc_error(-8, "passphrase cannot be empty", self.nodes[0].walletpassphrasechange, '', 'ff') + self.log.info("Test encryptwallet persistence") + self.nodes[0].unloadwallet(self.default_wallet_name) + self.nodes[0].loadwallet(self.default_wallet_name) + assert_raises_rpc_error(-13, "Please enter the wallet passphrase with walletpassphrase first", self.nodes[0].signmessage, address, msg) + # Check that walletpassphrase works self.nodes[0].walletpassphrase(passphrase, 2) ```
davidgumberg commented 2026-11-10 23:29:52 +00:00 (Migrated from github.com)

Sorry for the noise, made the change to a stale branch on a different machine.

Sorry for the noise, made the change to a stale branch on a different machine.
DrahtBot commented 2026-11-12 19:19:22 +00:00 (Migrated from github.com)

🐙 This pull request conflicts with the target branch and needs rebase.

<!--cf906140f33d8803c4a75a2196329ecb--> 🐙 This pull request conflicts with the target branch and [needs rebase](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#rebasing-changes).
w0xlt (Migrated from github.com) reviewed 2026-11-13 00:06:56 +00:00
w0xlt (Migrated from github.com) left a comment

reACK 8833e3e13f

reACK 8833e3e13fca1bbc80db53107e31e23855a650aa
Eunovo (Migrated from github.com) approved these changes 2026-11-13 10:30:00 +00:00
Eunovo (Migrated from github.com) left a comment
ACK https://github.com/bitcoin/bitcoin/pull/36387/commits/8833e3e13fca1bbc80db53107e31e23855a650aa
DrahtBot commented 2026-11-19 12:17:22 +00:00 (Migrated from github.com)

🐙 This pull request conflicts with the target branch and needs rebase.

<!--cf906140f33d8803c4a75a2196329ecb--> 🐙 This pull request conflicts with the target branch and [needs rebase](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#rebasing-changes).
davidgumberg commented 2026-11-19 20:42:47 +00:00 (Migrated from github.com)

Pushed a rebase to fix merge conflict.

Pushed a rebase to fix merge conflict.
w0xlt (Migrated from github.com) reviewed 2026-11-19 21:30:14 +00:00
w0xlt (Migrated from github.com) left a comment

reACK 820120eb46

reACK 820120eb466ff2242d99f4c77ae6f8fa77f4bc9c
achow101 commented 2026-11-20 21:38:46 +00:00 (Migrated from github.com)
ACK 820120eb466ff2242d99f4c77ae6f8fa77f4bc9c
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!36387
No description provided.