Skip to content

Commit 2acf773

Browse files
committed
wallet, interfaces, gui: Expose load_after_restore parameter
RestoreWallet has a load_after_restore parameter, expose this to callers using it through the wallet interface as well.
1 parent 482d255 commit 2acf773

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/interfaces/wallet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class WalletLoader : public ChainClient
328328
virtual std::string getWalletDir() = 0;
329329

330330
//! Restore backup wallet
331-
virtual util::Result<std::unique_ptr<Wallet>> restoreWallet(const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings) = 0;
331+
virtual util::Result<std::unique_ptr<Wallet>> restoreWallet(const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings, bool load_after_restore) = 0;
332332

333333
//! Migrate a wallet
334334
virtual util::Result<WalletMigrationResult> migrateWallet(const std::string& name, const SecureString& passphrase) = 0;

src/qt/walletcontroller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ void RestoreWalletActivity::restore(const fs::path& backup_file, const std::stri
409409
tr("Restoring Wallet <b>%1</b>…").arg(name.toHtmlEscaped()));
410410

411411
QTimer::singleShot(0, worker(), [this, backup_file, wallet_name] {
412-
auto wallet{node().walletLoader().restoreWallet(backup_file, wallet_name, m_warning_message)};
412+
auto wallet{node().walletLoader().restoreWallet(backup_file, wallet_name, m_warning_message, /*load_after_restore=*/true)};
413413

414414
if (wallet) {
415415
m_wallet_model = m_wallet_controller->getOrCreateWallet(std::move(*wallet));

src/wallet/interfaces.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,16 +608,15 @@ class WalletLoaderImpl : public WalletLoader
608608
return util::Error{error};
609609
}
610610
}
611-
util::Result<std::unique_ptr<Wallet>> restoreWallet(const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings) override
611+
util::Result<std::unique_ptr<Wallet>> restoreWallet(const fs::path& backup_file, const std::string& wallet_name, std::vector<bilingual_str>& warnings, bool load_after_restore) override
612612
{
613613
DatabaseStatus status;
614614
bilingual_str error;
615-
std::unique_ptr<Wallet> wallet{MakeWallet(m_context, RestoreWallet(m_context, backup_file, wallet_name, /*load_on_start=*/true, status, error, warnings))};
616-
if (wallet) {
617-
return wallet;
618-
} else {
615+
std::unique_ptr<Wallet> wallet{MakeWallet(m_context, RestoreWallet(m_context, backup_file, wallet_name, /*load_on_start=*/true, status, error, warnings, load_after_restore))};
616+
if (!error.empty()) {
619617
return util::Error{error};
620618
}
619+
return wallet;
621620
}
622621
util::Result<WalletMigrationResult> migrateWallet(const std::string& name, const SecureString& passphrase) override
623622
{

0 commit comments

Comments
 (0)