MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / AppInit

Function AppInit

src/bitcoind.cpp:61–177  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////////// Start

Source from the content-addressed store, hash-verified

59// Start
60//
61bool AppInit(int argc, char* argv[])
62{
63 boost::thread_group threadGroup;
64 CScheduler scheduler;
65
66 bool fRet = false;
67
68 //
69 // Parameters
70 //
71 // If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
72 ParseParameters(argc, argv);
73
74 // Process help and version before taking care about datadir
75 if (mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version"))
76 {
77 std::string strUsage = _("Bitcoin XT Daemon") + " " + _("version") + " " + FormatFullVersion() + "\n";
78
79 if (mapArgs.count("-version"))
80 {
81 strUsage += LicenseInfo();
82 }
83 else
84 {
85 strUsage += "\n" + _("Usage:") + "\n" +
86 " bitcoind [options] " + _("Start Bitcoin XT Daemon") + "\n";
87
88 strUsage += "\n" + HelpMessage(HMM_BITCOIND);
89 }
90
91 fprintf(stdout, "%s", strUsage.c_str());
92 return false;
93 }
94
95 try
96 {
97 if (!boost::filesystem::is_directory(GetDataDir(false)))
98 {
99 fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str());
100 return false;
101 }
102 try
103 {
104 ReadConfigFile(mapArgs, mapMultiArgs);
105 } catch (const std::exception& e) {
106 fprintf(stderr,"Error reading configuration file: %s\n", e.what());
107 return false;
108 }
109 // Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
110 try {
111 SelectParams(ChainNameFromCommandLine());
112 } catch(std::exception &e) {
113 fprintf(stderr, "Error: %s\n", e.what());
114 return false;
115 }
116
117 // Command-line RPC
118 bool fCommandLine = false;

Callers 1

mainFunction · 0.85

Calls 15

ParseParametersFunction · 0.85
_Function · 0.85
FormatFullVersionFunction · 0.85
LicenseInfoFunction · 0.85
HelpMessageFunction · 0.85
ReadConfigFileFunction · 0.85
SelectParamsFunction · 0.85
ChainNameFromCommandLineFunction · 0.85
IsSwitchCharFunction · 0.85
GetBoolArgFunction · 0.85
SoftSetBoolArgFunction · 0.85
AppInit2Function · 0.85

Tested by

no test coverage detected