refactor: Return enum in LockDirectory

This makes it easier to add more Error cases in the future. Also, add
missing util namespace.
This commit is contained in:
MarcoFalke
2023-07-14 11:26:45 +02:00
parent 64879f4c03
commit fa0afe7408
5 changed files with 48 additions and 33 deletions

View File

@@ -149,7 +149,7 @@ bool BerkeleyEnvironment::Open(bilingual_str& err)
fs::path pathIn = fs::PathFromString(strPath);
TryCreateDirectories(pathIn);
if (!LockDirectory(pathIn, ".walletlock")) {
if (util::LockDirectory(pathIn, ".walletlock") != util::LockResult::Success) {
LogPrintf("Cannot obtain a lock on wallet directory %s. Another instance may be using it.\n", strPath);
err = strprintf(_("Error initializing wallet database environment %s!"), fs::quoted(fs::PathToString(Directory())));
return false;