refactor: Implement restorewallet() logic in the wallet section

Currently restorewallet() logic is written in the RPC layer
and it can´t be reused by GUI. So it reimplements this in the
wallet and interface sections and then, GUI can access it.
This commit is contained in:
w0xlt
2021-12-14 19:18:56 -03:00
parent f727d814bd
commit 4807f73f48
4 changed files with 35 additions and 0 deletions

View File

@@ -552,6 +552,12 @@ public:
options.require_existing = true;
return MakeWallet(m_context, LoadWallet(m_context, name, true /* load_on_start */, options, status, error, warnings));
}
std::unique_ptr<Wallet> restoreWallet(const std::string& backup_file, const std::string& wallet_name, bilingual_str& error, std::vector<bilingual_str>& warnings) override
{
DatabaseStatus status;
return MakeWallet(m_context, RestoreWallet(m_context, backup_file, wallet_name, /*load_on_start=*/true, status, error, warnings));
}
std::string getWalletDir() override
{
return fs::PathToString(GetWalletDir());