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

Function AppInitRawTx

src/bitcoin-tx.cpp:86–128  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

84// CONTINUE_EXECUTION when it's expected to continue further.
85//
86static 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
130static void RegisterSetJson(const std::string& key, const std::string& rawJson)
131{

Callers 1

mainFunction · 0.85

Calls 12

SetupBitcoinTxArgsFunction · 0.85
SelectParamsFunction · 0.85
HelpRequestedFunction · 0.85
FormatFullVersionFunction · 0.85
FormatParagraphFunction · 0.85
LicenseInfoFunction · 0.85
ParseParametersMethod · 0.80
GetChainNameMethod · 0.80
GetBoolArgMethod · 0.80
IsArgSetMethod · 0.80
GetHelpMessageMethod · 0.80
formatFunction · 0.70

Tested by

no test coverage detected