gui: Add a menu item to restore then migrate a wallet file
What changed, and why it matters
This commit adds a new menu item in the Bitcoin Core desktop program that lets a user pick an old wallet backup file and restore it, then automatically convert ('migrate') it to the newer wallet format. It is a user-facing feature addition, not a fix for a security bug. There is no indication in the commit that it addresses a vulnerability.
No security action required. Treat as a normal feature commit. If reviewing for release, verify the underlying MigrateWalletActivity::restore_and_migrate implementation handles path validation, name uniqueness, and error reporting safely.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change adds a ‘Restore and Migrate Wallet File…’ action to the existing migrate-wallet menu in src/qt/bitcoingui.cpp. When triggered, it opens a file chooser for a .dat backup, prompts for a wallet name, creates a MigrateWalletActivity, and calls restore_and_migrate() with the chosen path and name. It wires up the migrated signal to set the current wallet in the GUI and RPC console. The commit is purely additive GUI plumbing.
Changed components
src/qt/bitcoingui.cppBitcoin Core GUI wallet migration menuInspect captured patch +26 / −0
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 9413356b..6aa8bae0 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -485,6 +485,32 @@ void BitcoinGUI::createActions()
QAction* action = m_migrate_wallet_menu->addAction(tr("No wallets available"));
action->setEnabled(false);
}
+ m_migrate_wallet_menu->addSeparator();
+ QAction* restore_migrate_file_action = m_migrate_wallet_menu->addAction(tr("Restore and Migrate Wallet File..."));
+ restore_migrate_file_action->setEnabled(true);
+
+ connect(restore_migrate_file_action, &QAction::triggered, [this] {
+ QString name_data_file = tr("Wallet Data");
+ QString title_windows = tr("Restore and Migrate Wallet Backup");
+
+ QString backup_file = GUIUtil::getOpenFileName(this, title_windows, QString(), name_data_file + QLatin1String(" (*.dat)"), nullptr);
+ if (backup_file.isEmpty()) return;
+
+ bool wallet_name_ok;
+ /*: Title of pop-up window shown when the user is attempting to
+ restore a wallet. */
+ QString title = tr("Restore and Migrate Wallet");
+ //: Label of the input field where the name of the wallet is entered.
+ QString label = tr("Wallet Name");
+ QString wallet_name = QInputDialog::getText(this, title, label, QLineEdit::Normal, "", &wallet_name_ok);
+ if (!wallet_name_ok || wallet_name.isEmpty()) return;
+
+ auto activity = new MigrateWalletActivity(m_wallet_controller, this);
+ connect(activity, &MigrateWalletActivity::migrated, this, &BitcoinGUI::setCurrentWallet);
+ connect(activity, &MigrateWalletActivity::migrated, rpcConsole, &RPCConsole::setCurrentWallet);
+ auto backup_file_path = fs::PathFromString(backup_file.toStdString());
+ activity->restore_and_migrate(backup_file_path, wallet_name.toStdString());
+ });
});
connect(m_mask_values_action, &QAction::toggled, this, &BitcoinGUI::setPrivacy);
connect(m_mask_values_action, &QAction::toggled, this, &BitcoinGUI::enableHistoryAction);
Why this scored 17/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.