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

Function main

src/bitcoin-wallet.cpp:91–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91int main(int argc, char* argv[])
92{
93 ArgsManager& args = gArgs;
94#ifdef WIN32
95 util::WinCmdLineArgs winArgs;
96 std::tie(argc, argv) = winArgs.get();
97#endif
98
99 int exit_status;
100 std::unique_ptr<interfaces::Init> init = interfaces::MakeWalletInit(argc, argv, exit_status);
101 if (!init) {
102 return exit_status;
103 }
104
105 SetupEnvironment();
106 RandomInit();
107 try {
108 if (!WalletAppInit(args, argc, argv)) return EXIT_FAILURE;
109 } catch (const std::exception& e) {
110 PrintExceptionContinue(&e, "WalletAppInit()");
111 return EXIT_FAILURE;
112 } catch (...) {
113 PrintExceptionContinue(nullptr, "WalletAppInit()");
114 return EXIT_FAILURE;
115 }
116
117 const auto command = args.GetCommand();
118 if (!command) {
119 tfm::format(std::cerr, "No method provided. Run `elements-wallet -help` for valid methods.\n");
120 return EXIT_FAILURE;
121 }
122 if (command->args.size() != 0) {
123 tfm::format(std::cerr, "Error: Additional arguments provided (%s). Methods do not take arguments. Please refer to `-help`.\n", Join(command->args, ", "));
124 return EXIT_FAILURE;
125 }
126
127 ECCVerifyHandle globalVerifyHandle;
128 ECC_Start();
129 if (!wallet::WalletTool::ExecuteWalletToolFunc(args, command->command)) {
130 return EXIT_FAILURE;
131 }
132 ECC_Stop();
133 return EXIT_SUCCESS;
134}

Callers

nothing calls this directly

Calls 13

MakeWalletInitFunction · 0.85
SetupEnvironmentFunction · 0.85
RandomInitFunction · 0.85
WalletAppInitFunction · 0.85
PrintExceptionContinueFunction · 0.85
JoinFunction · 0.85
ECC_StartFunction · 0.85
ExecuteWalletToolFuncFunction · 0.85
ECC_StopFunction · 0.85
formatFunction · 0.70
getMethod · 0.45
GetCommandMethod · 0.45

Tested by

no test coverage detected