From f3a444c45fb4bf4e51d53ebf1cf4c2631ded481c Mon Sep 17 00:00:00 2001 From: Ava Chow Date: Mon, 26 May 2025 13:23:04 -0700 Subject: [PATCH] gui: Disallow loading legacy wallets Instead of allowing users to load a legacy wallet from the "Open Wallet" menu, show the legacy wallet greyed out with a message that the wallet needs to be migrated. --- src/qt/bitcoingui.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 5ca9fba07ca..9413356b412 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -398,15 +398,19 @@ void BitcoinGUI::createActions() connect(m_open_wallet_menu, &QMenu::aboutToShow, [this] { m_open_wallet_menu->clear(); for (const auto& [path, info] : m_wallet_controller->listWalletDir()) { - const auto& [loaded, _] = info; + const auto& [loaded, format] = info; QString name = GUIUtil::WalletDisplayName(path); // An single ampersand in the menu item's text sets a shortcut for this item. // Single & are shown when && is in the string. So replace & with &&. name.replace(QChar('&'), QString("&&")); + bool is_legacy = format == "bdb"; + if (is_legacy) { + name += " (needs migration)"; + } QAction* action = m_open_wallet_menu->addAction(name); - if (loaded) { - // This wallet is already loaded + if (loaded || is_legacy) { + // This wallet is already loaded or it is a legacy wallet action->setEnabled(false); continue; }