aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-12-17 19:18:34 +0100
committerMarcoFalke <falke.marco@gmail.com>2020-12-17 19:16:00 +0100
commitfa7dde1c418e2e700853bd30cc9e012c4e4c5ef2 (patch)
treebc57aee77a56f97a31ce6f66f2f67255e6966661
parent143bd108ed6626405b0361c9939a8e1bf6cfc3d2 (diff)
wallet: Pass ArgsManager into ExecuteWalletToolFunc instead of using global
-rw-r--r--src/bitcoin-wallet.cpp3
-rw-r--r--src/wallet/wallettool.cpp8
-rw-r--r--src/wallet/wallettool.h2
3 files changed, 7 insertions, 6 deletions
diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp
index 0f8d312c5e..ef26ed3b95 100644
--- a/src/bitcoin-wallet.cpp
+++ b/src/bitcoin-wallet.cpp
@@ -120,8 +120,9 @@ int main(int argc, char* argv[])
ECCVerifyHandle globalVerifyHandle;
ECC_Start();
- if (!WalletTool::ExecuteWalletToolFunc(method, name))
+ if (!WalletTool::ExecuteWalletToolFunc(gArgs, method, name)) {
return EXIT_FAILURE;
+ }
ECC_Stop();
return EXIT_SUCCESS;
}
diff --git a/src/wallet/wallettool.cpp b/src/wallet/wallettool.cpp
index fe3fcb32c2..e16d7f6338 100644
--- a/src/wallet/wallettool.cpp
+++ b/src/wallet/wallettool.cpp
@@ -103,17 +103,17 @@ static void WalletShowInfo(CWallet* wallet_instance)
tfm::format(std::cout, "Address Book: %zu\n", wallet_instance->m_address_book.size());
}
-bool ExecuteWalletToolFunc(const std::string& command, const std::string& name)
+bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command, const std::string& name)
{
fs::path path = fs::absolute(name, GetWalletDir());
// -format is only allowed with createfromdump. Disallow it for all other commands.
- if (gArgs.IsArgSet("-format") && command != "createfromdump") {
+ if (args.IsArgSet("-format") && command != "createfromdump") {
tfm::format(std::cerr, "The -format option can only be used with the \"createfromdump\" command.\n");
return false;
}
// -dumpfile is only allowed with dump and createfromdump. Disallow it for all other commands.
- if (gArgs.IsArgSet("-dumpfile") && command != "dump" && command != "createfromdump") {
+ if (args.IsArgSet("-dumpfile") && command != "dump" && command != "createfromdump") {
tfm::format(std::cerr, "The -dumpfile option can only be used with the \"dump\" and \"createfromdump\" commands.\n");
return false;
}
@@ -121,7 +121,7 @@ bool ExecuteWalletToolFunc(const std::string& command, const std::string& name)
if (command == "create") {
DatabaseOptions options;
options.require_create = true;
- if (gArgs.GetBoolArg("-descriptors", false)) {
+ if (args.GetBoolArg("-descriptors", false)) {
options.create_flags |= WALLET_FLAG_DESCRIPTORS;
options.require_format = DatabaseFormat::SQLITE;
}
diff --git a/src/wallet/wallettool.h b/src/wallet/wallettool.h
index d0b8d6812a..6a9a810231 100644
--- a/src/wallet/wallettool.h
+++ b/src/wallet/wallettool.h
@@ -10,7 +10,7 @@
namespace WalletTool {
void WalletShowInfo(CWallet* wallet_instance);
-bool ExecuteWalletToolFunc(const std::string& command, const std::string& file);
+bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command, const std::string& file);
} // namespace WalletTool