wallet: disallow unnamed wallets in createwallet and restorewallet

Migration still needs to be able to restore unnamed wallets, so
allow_unnamed is added to RestoreWallet to explicitly allow that
behavior for migration only.
This commit is contained in:
Ava Chow committed 2026-01-19 10:55:55 -08:00
1 parent d30ad4a912
commit 5875a9c502
8 files changed
+39 -14

No files matched your search

+1
View File
@@ -32,6 +32,7 @@ class CreateWalletTest(BitcoinTestFramework):
# Run createwallet with invalid parameters. This must not prevent a new wallet with the same name from being created with the correct parameters.
assert_raises_rpc_error(-4, "Passphrase provided but private keys are disabled. A passphrase is only used to encrypt private keys, so cannot be used for wallets with private keys disabled.",
self.nodes[0].createwallet, wallet_name='w0', disable_private_keys=True, passphrase="passphrase")
assert_raises_rpc_error(-8, "Wallet name cannot be empty", self.nodes[0].createwallet, "")
self.nodes[0].createwallet(wallet_name='w0')
w0 = node.get_wallet_rpc('w0')