MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / do_migrate

Method do_migrate

src/qt/walletcontroller.cpp:442–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

440}
441
442void MigrateWalletActivity::do_migrate(const std::string& name)
443{
444 SecureString passphrase;
445 if (node().walletLoader().isEncrypted(name)) {
446 // Get the passphrase for the wallet
447 AskPassphraseDialog dlg(AskPassphraseDialog::UnlockMigration, m_parent_widget, &passphrase);
448 if (dlg.exec() == QDialog::Rejected) return;
449 }
450
451 showProgressDialog(tr("Migrate Wallet"), tr("Migrating Wallet <b>%1</b>…").arg(GUIUtil::HtmlEscape(name)));
452
453 QTimer::singleShot(0, worker(), [this, name, passphrase] {
454 auto res{node().walletLoader().migrateWallet(name, passphrase)};
455
456 if (res) {
457 m_success_message = tr("The wallet '%1' was migrated successfully.").arg(GUIUtil::HtmlEscape(GUIUtil::WalletDisplayName(name)));
458 if (res->watchonly_wallet_name) {
459 m_success_message += QChar(' ') + tr("Watchonly scripts have been migrated to a new wallet named '%1'.").arg(GUIUtil::HtmlEscape(GUIUtil::WalletDisplayName(res->watchonly_wallet_name.value())));
460 }
461 if (res->solvables_wallet_name) {
462 m_success_message += QChar(' ') + tr("Solvable but not watched scripts have been migrated to a new wallet named '%1'.").arg(GUIUtil::HtmlEscape(GUIUtil::WalletDisplayName(res->solvables_wallet_name.value())));
463 }
464 m_wallet_model = m_wallet_controller->getOrCreateWallet(std::move(res->wallet));
465 } else {
466 m_error_message = util::ErrorString(res);
467 }
468
469 QTimer::singleShot(0, this, &MigrateWalletActivity::finish);
470 });
471}
472
473void MigrateWalletActivity::migrate(const std::string& name)
474{

Callers

nothing calls this directly

Calls 8

HtmlEscapeFunction · 0.85
WalletDisplayNameFunction · 0.85
ErrorStringFunction · 0.85
isEncryptedMethod · 0.80
execMethod · 0.80
migrateWalletMethod · 0.80
getOrCreateWalletMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected