wallet: Explicitly say migratewallet on encrypted wallets is unsupported

Github-Pull: #26594
Rebased-From: 5e65a216d1fd00c447757736d4f2899d235e731a
This commit is contained in:
Andrew Chow 2022-11-29 16:05:51 -05:00 committed by fanquake
parent d464b2af30
commit 95fded1069
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1
2 changed files with 4 additions and 3 deletions

View File

@ -730,7 +730,9 @@ static RPCHelpMan migratewallet()
std::shared_ptr<CWallet> wallet = GetWalletForJSONRPCRequest(request);
if (!wallet) return NullUniValue;
EnsureWalletIsUnlocked(*wallet);
if (wallet->IsCrypted()) {
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: migratewallet on encrypted wallets is currently unsupported.");
}
WalletContext& context = EnsureWalletContext(request.context);

View File

@ -399,8 +399,7 @@ class WalletMigrationTest(BitcoinTestFramework):
wallet.encryptwallet("pass")
wallet.walletpassphrase("pass", 10)
assert_raises_rpc_error(-4, "Error: Unable to produce descriptors for this legacy wallet. Make sure the wallet is unlocked first", wallet.migratewallet)
assert_raises_rpc_error(-15, "Error: migratewallet on encrypted wallets is currently unsupported.", wallet.migratewallet)
# TODO: Fix migratewallet so that we can actually migrate encrypted wallets
def run_test(self):