With “unrelated” I meant “can be split up into its own atomic and logical commit without depending on other changes in this pull request”.
See the following commit on current master, which compiles fine and runs all tests fine as well:
0$ git show
1commit 43d120ec8a7a999a48ba31e2621efec06ca668f6 (HEAD)
2Author: MarcoFalke <falke.marco@gmail.com>
3Date: Thu Jul 2 07:53:05 2020 -0400
4
5 wallet: Remove redundant WalletBatch::VerifyEnvironment
6
7 It is redundant because LoadWallet will call CWallet::LoadWallet ->
8 LoadWalletInternal -> CWallet::Verify, which calls VerifyEnvironment
9
10 For SalvageWallet it is redundant with the newly added call to Open
11
12diff --git a/src/wallet/salvage.cpp b/src/wallet/salvage.cpp
13index d42950ee42..e6e62332c0 100644
14--- a/src/wallet/salvage.cpp
15+++ b/src/wallet/salvage.cpp
16@@ -20,6 +20,11 @@ bool RecoverDatabaseFile(const fs::path& file_path)
17 std::string filename;
18 std::shared_ptr<BerkeleyEnvironment> env = GetWalletEnv(file_path, filename);
19
20+ if (!env->Open(true /* retry */)) {
21+ tfm::format(std::cerr, "Error initializing wallet database environment %s!", env->Directory());
22+ return false;
23+ }
24+
25 // Recovery procedure:
26 // move wallet file to walletfilename.timestamp.bak
27 // Call Salvage with fAggressive=true to
28diff --git a/src/wallet/wallettool.cpp b/src/wallet/wallettool.cpp
29index 77ed6beb5d..430a866a7c 100644
30--- a/src/wallet/wallettool.cpp
31+++ b/src/wallet/wallettool.cpp
32@@ -140,11 +140,6 @@ bool ExecuteWalletToolFunc(const std::string& command, const std::string& name)
33 tfm::format(std::cerr, "Error: no wallet file at %s\n", name);
34 return false;
35 }
36- bilingual_str error;
37- if (!WalletBatch::VerifyEnvironment(path, error)) {
38- tfm::format(std::cerr, "%s\nError loading %s. Is wallet being used by other process?\n", error.original, name);
39- return false;
40- }
41
42 if (command == "info") {
43 std::shared_ptr<CWallet> wallet_instance = LoadWallet(name, path);
44diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py
45index 524e1593ba..18f0beb598 100755
46--- a/test/functional/tool_wallet.py
47+++ b/test/functional/tool_wallet.py
48@@ -71,8 +71,7 @@ class ToolWalletTest(BitcoinTestFramework):
49 self.assert_raises_tool_error('Error: two methods provided (info and create). Only one method should be provided.', 'info', 'create')
50 self.assert_raises_tool_error('Error parsing command line arguments: Invalid parameter -foo', '-foo')
51 self.assert_raises_tool_error(
52- 'Error initializing wallet database environment "{}"!\nError loading wallet.dat. Is wallet being used by other process?'
53- .format(os.path.join(self.nodes[0].datadir, self.chain, 'wallets')),
54+ 'Error loading wallet.dat. Is wallet being used by another process?',
55 '-wallet=wallet.dat',
56 'info',
57 )