Avoid logging IsBerkeleyBtree: No such file or directory .... The result of IsBerkeleyBtree is the same since fs::file_size() returns 0 for non existent files.
Fix #15912.
utACK 70c1cf8c1c07091544d060191715027282e87b57
utACK 70c1cf8c1c07091544d060191715027282e87b57
30 | @@ -31,6 +31,8 @@ fs::path GetWalletDir() 31 | 32 | static bool IsBerkeleyBtree(const fs::path& path) 33 | { 34 | + if (!fs::exists(path)) return false;
I don't understand this fix. When is this condition expected? Why not just drop the log statement entirely if we don't care about these errors?
If this behavior actually does make sense, a more readable and efficient way to implement it would be to drop this new access and change:
-if (ec) LogPrintf(...)
+if (ec && ec != errc::no_such_file_or_directory) LogPrintf(...)
below
It happens here:
when it->path() == "... /regtest/wallets/database".
If this behavior actually does make sense, a more readable and efficient way to implement it would be to drop this new access and change:
I had like that but though early checking is more clear.
I also had the check in L74:
if (it->status().type() == fs::directory_file && fs::exists(it->path() / "wallet.dat") && IsBerkeleyBtree(it->path() / "wallet.dat")) {
But figure out IsBerkeleyBtree could early return false when the path doesn't exists.