Skip to content

Commit 64226de

Browse files
committed
Generalise walletdir lock error message for correctness
1 parent c9ed4bd commit 64226de

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/wallet/db.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,12 @@ bool CDBEnv::Open(const fs::path& pathIn, bool retry)
121121

122122
boost::this_thread::interruption_point();
123123

124+
strPath = pathIn.string();
124125
if (!LockEnvDirectory(pathIn)) {
126+
LogPrintf("Cannot obtain a lock on wallet directory %s. Another instance of bitcoin may be using it.", strPath);
125127
return false;
126128
}
127129

128-
strPath = pathIn.string();
129130
fs::path pathLogDir = pathIn / "database";
130131
TryCreateDirectories(pathLogDir);
131132
fs::path pathErrorFile = pathIn / "db.log";
@@ -310,7 +311,7 @@ bool CDB::VerifyEnvironment(const std::string& walletFile, const fs::path& walle
310311
}
311312

312313
if (!bitdb.Open(walletDir, true)) {
313-
errorStr = strprintf(_("Cannot obtain a lock on wallet directory %s. Another instance of bitcoin may be using it."), walletDir);
314+
errorStr = strprintf(_("Error initializing wallet database environment %s!"), walletDir);
314315
return false;
315316
}
316317

test/functional/multiwallet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def run_test(self):
7171
competing_wallet_dir = os.path.join(self.options.tmpdir, 'competing_walletdir')
7272
os.mkdir(competing_wallet_dir)
7373
self.restart_node(0, ['-walletdir='+competing_wallet_dir])
74-
self.assert_start_raises_init_error(1, ['-walletdir='+competing_wallet_dir], 'Cannot obtain a lock on wallet directory')
74+
self.assert_start_raises_init_error(1, ['-walletdir='+competing_wallet_dir], 'Error initializing wallet database environment')
7575

7676
self.restart_node(0, self.extra_args[0])
7777

0 commit comments

Comments
 (0)