Skip to content

Commit f3a444c

Browse files
committed
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.
1 parent 0995517 commit f3a444c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/qt/bitcoingui.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,15 +398,19 @@ void BitcoinGUI::createActions()
398398
connect(m_open_wallet_menu, &QMenu::aboutToShow, [this] {
399399
m_open_wallet_menu->clear();
400400
for (const auto& [path, info] : m_wallet_controller->listWalletDir()) {
401-
const auto& [loaded, _] = info;
401+
const auto& [loaded, format] = info;
402402
QString name = GUIUtil::WalletDisplayName(path);
403403
// An single ampersand in the menu item's text sets a shortcut for this item.
404404
// Single & are shown when && is in the string. So replace & with &&.
405405
name.replace(QChar('&'), QString("&&"));
406+
bool is_legacy = format == "bdb";
407+
if (is_legacy) {
408+
name += " (needs migration)";
409+
}
406410
QAction* action = m_open_wallet_menu->addAction(name);
407411

408-
if (loaded) {
409-
// This wallet is already loaded
412+
if (loaded || is_legacy) {
413+
// This wallet is already loaded or it is a legacy wallet
410414
action->setEnabled(false);
411415
continue;
412416
}

0 commit comments

Comments
 (0)