@@ -19,9 +19,9 @@ namespace wallet {
1919bool operator <(BytePrefix a, Span<const std::byte> b) { return a.prefix < b.subspan (0 , std::min (a.prefix .size (), b.size ())); }
2020bool operator <(Span<const std::byte> a, BytePrefix b) { return a.subspan (0 , std::min (a.size (), b.prefix .size ())) < b.prefix ; }
2121
22- std::vector<fs::path> ListDatabases (const fs::path& wallet_dir)
22+ std::vector<std::pair< fs::path, std::string> > ListDatabases (const fs::path& wallet_dir)
2323{
24- std::vector<fs::path> paths;
24+ std::vector<std::pair< fs::path, std::string> > paths;
2525 std::error_code ec;
2626
2727 for (auto it = fs::recursive_directory_iterator (wallet_dir, ec); it != fs::recursive_directory_iterator (); it.increment (ec)) {
@@ -38,21 +38,25 @@ std::vector<fs::path> ListDatabases(const fs::path& wallet_dir)
3838 try {
3939 const fs::path path{it->path ().lexically_relative (wallet_dir)};
4040
41- if (it->status ().type () == fs::file_type::directory &&
42- (IsBDBFile (BDBDataFile (it->path ())) || IsSQLiteFile (SQLiteDataFile (it->path ())))) {
43- // Found a directory which contains wallet.dat btree file, add it as a wallet.
44- paths.emplace_back (path);
41+ if (it->status ().type () == fs::file_type::directory) {
42+ if (IsBDBFile (BDBDataFile (it->path ()))) {
43+ // Found a directory which contains wallet.dat btree file, add it as a wallet with BERKELEY format.
44+ paths.emplace_back (path, " bdb" );
45+ } else if (IsSQLiteFile (SQLiteDataFile (it->path ()))) {
46+ // Found a directory which contains wallet.dat sqlite file, add it as a wallet with SQLITE format.
47+ paths.emplace_back (path, " sqlite" );
48+ }
4549 } else if (it.depth () == 0 && it->symlink_status ().type () == fs::file_type::regular && IsBDBFile (it->path ())) {
4650 if (it->path ().filename () == " wallet.dat" ) {
4751 // Found top-level wallet.dat btree file, add top level directory ""
4852 // as a wallet.
49- paths.emplace_back ();
53+ paths.emplace_back (fs::path (), " bdb " );
5054 } else {
5155 // Found top-level btree file not called wallet.dat. Current bitcoin
5256 // software will never create these files but will allow them to be
5357 // opened in a shared database environment for backwards compatibility.
5458 // Add it to the list of available wallets.
55- paths.emplace_back (path);
59+ paths.emplace_back (path, " bdb " );
5660 }
5761 }
5862 } catch (const std::exception& e) {
0 commit comments