From c1785d2cfd5b13393ef15e2496c3d506d6e3bdf8 Mon Sep 17 00:00:00 2001 From: random-zebra Date: Thu, 10 Dec 2020 00:53:49 +0100 Subject: [PATCH] [BUG][RPC] Fix check in wallet upgrade RPC --- src/wallet/rpcwallet.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index dc515daafd58..6afae95992b8 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -380,15 +380,15 @@ UniValue upgradewallet(const JSONRPCRequest& request) ); EnsureWallet(); - EnsureWalletIsUnlocked(); - LOCK2(cs_main, pwalletMain->cs_wallet); - // Do not do anything to non-HD wallets - if (pwalletMain->HasSaplingSPKM()) { + // Do not do anything to wallets already upgraded + if (pwalletMain->CanSupportFeature(FEATURE_LATEST)) { throw JSONRPCError(RPC_WALLET_ERROR, "Cannot upgrade the wallet. The wallet is already running the latest version"); } + EnsureWalletIsUnlocked(); + // Get version int prev_version = pwalletMain->GetVersion(); // Upgrade wallet's version