gui: Use wallet name for wallet migration rather than WalletModel
To prepare for migrating wallets that are not loaded, when migration occurs in the GUI, it should not rely on a WalletModel existing. Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
This commit is contained in:
1 parent
c3918583dd
commit
d56a450bf5
9 files changed
+51
-18
No files matched your search
@@ -652,6 +652,21 @@ public:
|
||||
};
|
||||
return out;
|
||||
}
|
||||
bool isEncrypted(const std::string& wallet_name) override
|
||||
{
|
||||
auto wallets{GetWallets(m_context)};
|
||||
auto it = std::find_if(wallets.begin(), wallets.end(), [&](std::shared_ptr<CWallet> w){ return w->GetName() == wallet_name; });
|
||||
if (it != wallets.end()) return (*it)->IsCrypted();
|
||||
|
||||
// Unloaded wallet, read db
|
||||
DatabaseOptions options;
|
||||
options.require_existing = true;
|
||||
DatabaseStatus status;
|
||||
bilingual_str error;
|
||||
auto db = MakeWalletDatabase(wallet_name, options, status, error);
|
||||
if (!db) return false;
|
||||
return WalletBatch(*db).IsEncrypted();
|
||||
}
|
||||
std::string getWalletDir() override
|
||||
{
|
||||
return fs::PathToString(GetWalletDir());
|
||||
|
||||
Reference in new issue
Block a user