MCPcopy Create free account
hub / github.com/ElementsProject/elements / WalletAppInit

Function WalletAppInit

src/bitcoin-wallet.cpp:52–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52static bool WalletAppInit(ArgsManager& args, int argc, char* argv[])
53{
54 SetupWalletToolArgs(args);
55 std::string error_message;
56 if (!args.ParseParameters(argc, argv, error_message)) {
57 tfm::format(std::cerr, "Error parsing command line arguments: %s\n", error_message);
58 return false;
59 }
60 if (argc < 2 || HelpRequested(args) || args.IsArgSet("-version")) {
61 std::string strUsage = strprintf("%s elements-wallet version", PACKAGE_NAME) + " " + FormatFullVersion() + "\n";
62
63 if (args.IsArgSet("-version")) {
64 strUsage += FormatParagraph(LicenseInfo());
65 } else {
66 strUsage += "\n"
67 "elements-wallet is an offline tool for creating and interacting with " PACKAGE_NAME " wallet files.\n"
68 "By default elements-wallet will act on wallets in the default mainnet wallet directory in the datadir.\n"
69 "To change the target wallet, use the -datadir, -wallet and -regtest/-signet/-testnet arguments.\n\n"
70 "Usage:\n"
71 " elements-wallet [options] <command>\n";
72 strUsage += "\n" + args.GetHelpMessage();
73 }
74 tfm::format(std::cout, "%s", strUsage);
75 return false;
76 }
77
78 // check for printtoconsole, allow -debug
79 LogInstance().m_print_to_console = args.GetBoolArg("-printtoconsole", args.GetBoolArg("-debug", false));
80
81 if (!CheckDataDirOption()) {
82 tfm::format(std::cerr, "Error: Specified data directory \"%s\" does not exist.\n", args.GetArg("-datadir", ""));
83 return false;
84 }
85 // Check for chain settings (Params() calls are only valid after this clause)
86 SelectParams(args.GetChainName());
87
88 return true;
89}
90
91int main(int argc, char* argv[])
92{

Callers 1

mainFunction · 0.85

Calls 14

SetupWalletToolArgsFunction · 0.85
HelpRequestedFunction · 0.85
FormatFullVersionFunction · 0.85
FormatParagraphFunction · 0.85
LicenseInfoFunction · 0.85
CheckDataDirOptionFunction · 0.85
SelectParamsFunction · 0.85
ParseParametersMethod · 0.80
IsArgSetMethod · 0.80
GetHelpMessageMethod · 0.80
GetBoolArgMethod · 0.80
GetArgMethod · 0.80

Tested by

no test coverage detected