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.
| 42 | // This function returns either one of EXIT_ codes when it's expected to stop the process or |
| 43 | // CONTINUE_EXECUTION when it's expected to continue further. |
| 44 | static int AppInitUtil(ArgsManager& args, int argc, char* argv[]) |
| 45 | { |
| 46 | SetupBitcoinUtilArgs(args); |
| 47 | std::string error; |
| 48 | if (!args.ParseParameters(argc, argv, error)) { |
| 49 | tfm::format(std::cerr, "Error parsing command line arguments: %s\n", error); |
| 50 | return EXIT_FAILURE; |
| 51 | } |
| 52 | |
| 53 | if (HelpRequested(args) || args.IsArgSet("-version")) { |
| 54 | // First part of help message is specific to this utility |
| 55 | std::string strUsage = PACKAGE_NAME " bitcoin-util utility version " + FormatFullVersion() + "\n"; |
| 56 | |
| 57 | if (args.IsArgSet("-version")) { |
| 58 | strUsage += FormatParagraph(LicenseInfo()); |
| 59 | } else { |
| 60 | strUsage += "\n" |
| 61 | "Usage: bitcoin-util [options] [commands] Do stuff\n"; |
| 62 | strUsage += "\n" + args.GetHelpMessage(); |
| 63 | } |
| 64 | |
| 65 | tfm::format(std::cout, "%s", strUsage); |
| 66 | |
| 67 | if (argc < 2) { |
| 68 | tfm::format(std::cerr, "Error: too few parameters\n"); |
| 69 | return EXIT_FAILURE; |
| 70 | } |
| 71 | return EXIT_SUCCESS; |
| 72 | } |
| 73 | |
| 74 | // Check for chain settings (Params() calls are only valid after this clause) |
| 75 | try { |
| 76 | SelectParams(args.GetChainName()); |
| 77 | } catch (const std::exception& e) { |
| 78 | tfm::format(std::cerr, "Error: %s\n", e.what()); |
| 79 | return EXIT_FAILURE; |
| 80 | } |
| 81 | |
| 82 | return CONTINUE_EXECUTION; |
| 83 | } |
| 84 | |
| 85 | static void grind_task(uint32_t nBits, CBlockHeader& header_orig, uint32_t offset, uint32_t step, std::atomic<bool>& found) |
| 86 | { |
no test coverage detected