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