Skip to content

Commit fa7dde1

Browse files
author
MarcoFalke
committed
wallet: Pass ArgsManager into ExecuteWalletToolFunc instead of using global
1 parent 143bd10 commit fa7dde1

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/bitcoin-wallet.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ int main(int argc, char* argv[])
120120

121121
ECCVerifyHandle globalVerifyHandle;
122122
ECC_Start();
123-
if (!WalletTool::ExecuteWalletToolFunc(method, name))
123+
if (!WalletTool::ExecuteWalletToolFunc(gArgs, method, name)) {
124124
return EXIT_FAILURE;
125+
}
125126
ECC_Stop();
126127
return EXIT_SUCCESS;
127128
}

src/wallet/wallettool.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,25 +103,25 @@ static void WalletShowInfo(CWallet* wallet_instance)
103103
tfm::format(std::cout, "Address Book: %zu\n", wallet_instance->m_address_book.size());
104104
}
105105

106-
bool ExecuteWalletToolFunc(const std::string& command, const std::string& name)
106+
bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command, const std::string& name)
107107
{
108108
fs::path path = fs::absolute(name, GetWalletDir());
109109

110110
// -format is only allowed with createfromdump. Disallow it for all other commands.
111-
if (gArgs.IsArgSet("-format") && command != "createfromdump") {
111+
if (args.IsArgSet("-format") && command != "createfromdump") {
112112
tfm::format(std::cerr, "The -format option can only be used with the \"createfromdump\" command.\n");
113113
return false;
114114
}
115115
// -dumpfile is only allowed with dump and createfromdump. Disallow it for all other commands.
116-
if (gArgs.IsArgSet("-dumpfile") && command != "dump" && command != "createfromdump") {
116+
if (args.IsArgSet("-dumpfile") && command != "dump" && command != "createfromdump") {
117117
tfm::format(std::cerr, "The -dumpfile option can only be used with the \"dump\" and \"createfromdump\" commands.\n");
118118
return false;
119119
}
120120

121121
if (command == "create") {
122122
DatabaseOptions options;
123123
options.require_create = true;
124-
if (gArgs.GetBoolArg("-descriptors", false)) {
124+
if (args.GetBoolArg("-descriptors", false)) {
125125
options.create_flags |= WALLET_FLAG_DESCRIPTORS;
126126
options.require_format = DatabaseFormat::SQLITE;
127127
}

src/wallet/wallettool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace WalletTool {
1111

1212
void WalletShowInfo(CWallet* wallet_instance);
13-
bool ExecuteWalletToolFunc(const std::string& command, const std::string& file);
13+
bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command, const std::string& file);
1414

1515
} // namespace WalletTool
1616

0 commit comments

Comments
 (0)