Browse Source

Generalise walletdir lock error message for correctness

0.16
MeshCollider 7 years ago
parent
commit
64226de908
  1. 5
      src/wallet/db.cpp
  2. 2
      test/functional/multiwallet.py

5
src/wallet/db.cpp

@ -121,11 +121,12 @@ bool CDBEnv::Open(const fs::path& pathIn, bool retry)
boost::this_thread::interruption_point(); boost::this_thread::interruption_point();
strPath = pathIn.string();
if (!LockEnvDirectory(pathIn)) { if (!LockEnvDirectory(pathIn)) {
LogPrintf("Cannot obtain a lock on wallet directory %s. Another instance of bitcoin may be using it.", strPath);
return false; return false;
} }
strPath = pathIn.string();
fs::path pathLogDir = pathIn / "database"; fs::path pathLogDir = pathIn / "database";
TryCreateDirectories(pathLogDir); TryCreateDirectories(pathLogDir);
fs::path pathErrorFile = pathIn / "db.log"; fs::path pathErrorFile = pathIn / "db.log";
@ -310,7 +311,7 @@ bool CDB::VerifyEnvironment(const std::string& walletFile, const fs::path& walle
} }
if (!bitdb.Open(walletDir, true)) { if (!bitdb.Open(walletDir, true)) {
errorStr = strprintf(_("Cannot obtain a lock on wallet directory %s. Another instance of bitcoin may be using it."), walletDir); errorStr = strprintf(_("Error initializing wallet database environment %s!"), walletDir);
return false; return false;
} }

2
test/functional/multiwallet.py

@ -71,7 +71,7 @@ class MultiWalletTest(BitcoinTestFramework):
competing_wallet_dir = os.path.join(self.options.tmpdir, 'competing_walletdir') competing_wallet_dir = os.path.join(self.options.tmpdir, 'competing_walletdir')
os.mkdir(competing_wallet_dir) os.mkdir(competing_wallet_dir)
self.restart_node(0, ['-walletdir='+competing_wallet_dir]) self.restart_node(0, ['-walletdir='+competing_wallet_dir])
self.assert_start_raises_init_error(1, ['-walletdir='+competing_wallet_dir], 'Cannot obtain a lock on wallet directory') self.assert_start_raises_init_error(1, ['-walletdir='+competing_wallet_dir], 'Error initializing wallet database environment')
self.restart_node(0, self.extra_args[0]) self.restart_node(0, self.extra_args[0])

Loading…
Cancel
Save