Skip to content

Commit 5e65a21

Browse files
committed
wallet: Explicitly say migratewallet on encrypted wallets is unsupported
1 parent 88afc73 commit 5e65a21

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/wallet/rpc/wallet.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,9 @@ static RPCHelpMan migratewallet()
730730
std::shared_ptr<CWallet> wallet = GetWalletForJSONRPCRequest(request);
731731
if (!wallet) return NullUniValue;
732732

733-
EnsureWalletIsUnlocked(*wallet);
733+
if (wallet->IsCrypted()) {
734+
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: migratewallet on encrypted wallets is currently unsupported.");
735+
}
734736

735737
WalletContext& context = EnsureWalletContext(request.context);
736738

test/functional/wallet_migration.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,7 @@ def test_encrypted(self):
399399

400400
wallet.encryptwallet("pass")
401401

402-
wallet.walletpassphrase("pass", 10)
403-
assert_raises_rpc_error(-4, "Error: Unable to produce descriptors for this legacy wallet. Make sure the wallet is unlocked first", wallet.migratewallet)
402+
assert_raises_rpc_error(-15, "Error: migratewallet on encrypted wallets is currently unsupported.", wallet.migratewallet)
404403
# TODO: Fix migratewallet so that we can actually migrate encrypted wallets
405404

406405
def run_test(self):

0 commit comments

Comments
 (0)