mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-18 08:32:30 +01:00
gui: Move actual migration part of migrate() to its own function
We will need to use the same migration code in a later commit, so first move it to a separate function.
This commit is contained in:
@@ -439,22 +439,8 @@ void RestoreWalletActivity::finish()
|
|||||||
Q_EMIT finished();
|
Q_EMIT finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MigrateWalletActivity::migrate(const std::string& name)
|
void MigrateWalletActivity::do_migrate(const std::string& name)
|
||||||
{
|
{
|
||||||
// Warn the user about migration
|
|
||||||
QMessageBox box(m_parent_widget);
|
|
||||||
box.setWindowTitle(tr("Migrate wallet"));
|
|
||||||
box.setText(tr("Are you sure you wish to migrate the wallet <i>%1</i>?").arg(GUIUtil::HtmlEscape(GUIUtil::WalletDisplayName(name))));
|
|
||||||
box.setInformativeText(tr("Migrating the wallet will convert this wallet to one or more descriptor wallets. A new wallet backup will need to be made.\n"
|
|
||||||
"If this wallet contains any watchonly scripts, a new wallet will be created which contains those watchonly scripts.\n"
|
|
||||||
"If this wallet contains any solvable but not watched scripts, a different and new wallet will be created which contains those scripts.\n\n"
|
|
||||||
"The migration process will create a backup of the wallet before migrating. This backup file will be named "
|
|
||||||
"<wallet name>-<timestamp>.legacy.bak and can be found in the directory for this wallet. In the event of "
|
|
||||||
"an incorrect migration, the backup can be restored with the \"Restore Wallet\" functionality."));
|
|
||||||
box.setStandardButtons(QMessageBox::Yes|QMessageBox::Cancel);
|
|
||||||
box.setDefaultButton(QMessageBox::Yes);
|
|
||||||
if (box.exec() != QMessageBox::Yes) return;
|
|
||||||
|
|
||||||
SecureString passphrase;
|
SecureString passphrase;
|
||||||
if (node().walletLoader().isEncrypted(name)) {
|
if (node().walletLoader().isEncrypted(name)) {
|
||||||
// Get the passphrase for the wallet
|
// Get the passphrase for the wallet
|
||||||
@@ -484,6 +470,25 @@ void MigrateWalletActivity::migrate(const std::string& name)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MigrateWalletActivity::migrate(const std::string& name)
|
||||||
|
{
|
||||||
|
// Warn the user about migration
|
||||||
|
QMessageBox box(m_parent_widget);
|
||||||
|
box.setWindowTitle(tr("Migrate wallet"));
|
||||||
|
box.setText(tr("Are you sure you wish to migrate the wallet <i>%1</i>?").arg(GUIUtil::HtmlEscape(GUIUtil::WalletDisplayName(name))));
|
||||||
|
box.setInformativeText(tr("Migrating the wallet will convert this wallet to one or more descriptor wallets. A new wallet backup will need to be made.\n"
|
||||||
|
"If this wallet contains any watchonly scripts, a new wallet will be created which contains those watchonly scripts.\n"
|
||||||
|
"If this wallet contains any solvable but not watched scripts, a different and new wallet will be created which contains those scripts.\n\n"
|
||||||
|
"The migration process will create a backup of the wallet before migrating. This backup file will be named "
|
||||||
|
"<wallet name>-<timestamp>.legacy.bak and can be found in the directory for this wallet. In the event of "
|
||||||
|
"an incorrect migration, the backup can be restored with the \"Restore Wallet\" functionality."));
|
||||||
|
box.setStandardButtons(QMessageBox::Yes|QMessageBox::Cancel);
|
||||||
|
box.setDefaultButton(QMessageBox::Yes);
|
||||||
|
if (box.exec() != QMessageBox::Yes) return;
|
||||||
|
|
||||||
|
do_migrate(name);
|
||||||
|
}
|
||||||
|
|
||||||
void MigrateWalletActivity::finish()
|
void MigrateWalletActivity::finish()
|
||||||
{
|
{
|
||||||
if (!m_error_message.empty()) {
|
if (!m_error_message.empty()) {
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ Q_SIGNALS:
|
|||||||
private:
|
private:
|
||||||
QString m_success_message;
|
QString m_success_message;
|
||||||
|
|
||||||
|
void do_migrate(const std::string& name);
|
||||||
void finish();
|
void finish();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user