aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/interfaces.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/interfaces.cpp')
-rw-r--r--src/wallet/interfaces.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp
index 9fab1b2ee4..21e8a0b3bd 100644
--- a/src/wallet/interfaces.cpp
+++ b/src/wallet/interfaces.cpp
@@ -652,15 +652,30 @@ 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());
}
- std::vector<std::string> listWalletDir() override
+ std::vector<std::pair<std::string, std::string>> listWalletDir() override
{
- std::vector<std::string> paths;
- for (auto& path : ListDatabases(GetWalletDir())) {
- paths.push_back(fs::PathToString(path));
+ std::vector<std::pair<std::string, std::string>> paths;
+ for (auto& [path, format] : ListDatabases(GetWalletDir())) {
+ paths.emplace_back(fs::PathToString(path), format);
}
return paths;
}