Skip to content

Commit c1785d2

Browse files
committed
[BUG][RPC] Fix check in wallet upgrade RPC
1 parent 8b04db1 commit c1785d2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,15 +380,15 @@ UniValue upgradewallet(const JSONRPCRequest& request)
380380
);
381381

382382
EnsureWallet();
383-
EnsureWalletIsUnlocked();
384-
385383
LOCK2(cs_main, pwalletMain->cs_wallet);
386384

387-
// Do not do anything to non-HD wallets
388-
if (pwalletMain->HasSaplingSPKM()) {
385+
// Do not do anything to wallets already upgraded
386+
if (pwalletMain->CanSupportFeature(FEATURE_LATEST)) {
389387
throw JSONRPCError(RPC_WALLET_ERROR, "Cannot upgrade the wallet. The wallet is already running the latest version");
390388
}
391389

390+
EnsureWalletIsUnlocked();
391+
392392
// Get version
393393
int prev_version = pwalletMain->GetVersion();
394394
// Upgrade wallet's version

0 commit comments

Comments
 (0)