This function returns either one of EXIT_ codes when it's expected to stop the process or CONTINUE_EXECUTION when it's expected to continue further.
| 84 | // CONTINUE_EXECUTION when it's expected to continue further. |
| 85 | // |
| 86 | static int AppInitRawTx(int argc, char* argv[]) |
| 87 | { |
| 88 | SetupBitcoinTxArgs(gArgs); |
| 89 | std::string error; |
| 90 | if (!gArgs.ParseParameters(argc, argv, error)) { |
| 91 | tfm::format(std::cerr, "Error parsing command line arguments: %s\n", error); |
| 92 | return EXIT_FAILURE; |
| 93 | } |
| 94 | |
| 95 | // Check for chain settings (Params() calls are only valid after this clause) |
| 96 | try { |
| 97 | SelectParams(gArgs.GetChainName()); |
| 98 | } catch (const std::exception& e) { |
| 99 | tfm::format(std::cerr, "Error: %s\n", e.what()); |
| 100 | return EXIT_FAILURE; |
| 101 | } |
| 102 | |
| 103 | fCreateBlank = gArgs.GetBoolArg("-create", false); |
| 104 | |
| 105 | if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) { |
| 106 | // First part of help message is specific to this utility |
| 107 | std::string strUsage = PACKAGE_NAME " elements-tx utility version " + FormatFullVersion() + "\n"; |
| 108 | |
| 109 | if (gArgs.IsArgSet("-version")) { |
| 110 | strUsage += FormatParagraph(LicenseInfo()); |
| 111 | } else { |
| 112 | strUsage += "\n" |
| 113 | "Usage: elements-tx [options] <hex-tx> [commands] Update hex-encoded Elements transaction\n" |
| 114 | "or: elements-tx [options] -create [commands] Create hex-encoded Elements transaction\n" |
| 115 | "\n"; |
| 116 | strUsage += gArgs.GetHelpMessage(); |
| 117 | } |
| 118 | |
| 119 | tfm::format(std::cout, "%s", strUsage); |
| 120 | |
| 121 | if (argc < 2) { |
| 122 | tfm::format(std::cerr, "Error: too few parameters\n"); |
| 123 | return EXIT_FAILURE; |
| 124 | } |
| 125 | return EXIT_SUCCESS; |
| 126 | } |
| 127 | return CONTINUE_EXECUTION; |
| 128 | } |
| 129 | |
| 130 | static void RegisterSetJson(const std::string& key, const std::string& rawJson) |
| 131 | { |
no test coverage detected