| 317 | } |
| 318 | |
| 319 | bool BerkeleyBatch::VerifyEnvironment(const fs::path& file_path, std::string& errorStr) |
| 320 | { |
| 321 | std::string walletFile; |
| 322 | BerkeleyEnvironment* env = GetWalletEnv(file_path, walletFile); |
| 323 | fs::path walletDir = env->Directory(); |
| 324 | |
| 325 | LogPrintf("Using BerkeleyDB version %s\n", DbEnv::version(0, 0, 0)); |
| 326 | LogPrintf("Using wallet %s\n", walletFile); |
| 327 | |
| 328 | // Wallet file must be a plain filename without a directory |
| 329 | if (walletFile != fs::basename(walletFile) + fs::extension(walletFile)) |
| 330 | { |
| 331 | errorStr = strprintf(_("Wallet %s resides outside wallet directory %s"), walletFile, walletDir.string()); |
| 332 | return false; |
| 333 | } |
| 334 | |
| 335 | if (!env->Open(true /* retry */)) { |
| 336 | errorStr = strprintf(_("Error initializing wallet database environment %s!"), walletDir); |
| 337 | return false; |
| 338 | } |
| 339 | |
| 340 | return true; |
| 341 | } |
| 342 | |
| 343 | bool BerkeleyBatch::VerifyDatabaseFile(const fs::path& file_path, std::string& warningStr, std::string& errorStr, BerkeleyEnvironment::recoverFunc_type recoverFunc) |
| 344 | { |
nothing calls this directly
no test coverage detected