MCPcopy Create free account
hub / github.com/LUX-Core/lux / AppInitRPC

Function AppInitRPC

src/lux-cli.cpp:67–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65};
66
67static bool AppInitRPC(int argc, char* argv[])
68{
69 //
70 // Parameters
71 //
72 ParseParameters(argc, argv);
73 if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) {
74 std::string strUsage = _("Luxcore RPC client version") + " " + FormatFullVersion() + "\n";
75 if (!mapArgs.count("-version")) {
76 strUsage += "\n" + _("Usage:") + "\n" +
77 " lux-cli [options] <command> [params] " + _("Send command to Luxcore") + "\n" +
78 " lux-cli [options] help " + _("List commands") + "\n" +
79 " lux-cli [options] help <command> " + _("Get help for a command") + "\n";
80
81 strUsage += "\n" + HelpMessageCli();
82 }
83
84 fprintf(stdout, "%s", strUsage.c_str());
85 return false;
86 }
87 if (!boost::filesystem::is_directory(GetDataDir(false))) {
88 fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str());
89 return false;
90 }
91 try {
92 ReadConfigFile(mapArgs, mapMultiArgs);
93 } catch (std::exception& e) {
94 fprintf(stderr, "Error reading configuration file: %s\n", e.what());
95 return false;
96 }
97 // Check for -testnet or -regtest parameter (BaseParams() calls are only valid after this clause)
98 if (!SelectBaseParamsFromCommandLine()) {
99 fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n");
100 return false;
101 }
102 if (GetBoolArg("-rpcssl", false))
103 {
104 fprintf(stderr, "Error: SSL mode for RPC (-rpcssl) is no longer supported.\n");
105 return false;
106 }
107 return true;
108}
109
110
111/** Reply structure for request_done to fill in */

Callers 1

mainFunction · 0.85

Calls 9

ParseParametersFunction · 0.85
_Function · 0.85
FormatFullVersionFunction · 0.85
HelpMessageCliFunction · 0.85
ReadConfigFileFunction · 0.85
GetBoolArgFunction · 0.85
countMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected