MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / AppInitMain

Function AppInitMain

src/init.cpp:1226–1767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1224}
1225
1226bool AppInitMain()
1227{
1228 const CChainParams& chainparams = Params();
1229 // ********************************************************* Step 4a: application initialization
1230#ifndef WIN32
1231 CreatePidFile(GetPidFile(), getpid());
1232#endif
1233 if (g_logger->m_print_to_file) {
1234 if (gArgs.GetBoolArg("-shrinkdebugfile", g_logger->DefaultShrinkDebugFile())) {
1235 // Do this first since it both loads a bunch of debug.log into memory,
1236 // and because this needs to happen before any other debug.log printing
1237 g_logger->ShrinkDebugFile();
1238 }
1239 if (!g_logger->OpenDebugLog()) {
1240 return InitError(strprintf("Could not open debug log file %s",
1241 g_logger->m_file_path.string()));
1242 }
1243 }
1244
1245 if (!g_logger->m_log_timestamps)
1246 LogPrintf("Startup time: %s\n", FormatISO8601DateTime(GetTime()));
1247 LogPrintf("Default data directory %s\n", GetDefaultDataDir().string());
1248 LogPrintf("Using data directory %s\n", GetDataDir().string());
1249 LogPrintf("Using config file %s\n", GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)).string());
1250 LogPrintf("Using at most %i automatic connections (%i file descriptors available)\n", nMaxConnections, nFD);
1251
1252 // Warn about relative -datadir path.
1253 if (gArgs.IsArgSet("-datadir") && !fs::path(gArgs.GetArg("-datadir", "")).is_absolute()) {
1254 LogPrintf("Warning: relative datadir option '%s' specified, which will be interpreted relative to the " /* Continued */
1255 "current working directory '%s'. This is fragile, because if bitcoin is started in the future "
1256 "from a different location, it will be unable to locate the current data files. There could "
1257 "also be data loss if bitcoin is started while in a temporary directory.\n",
1258 gArgs.GetArg("-datadir", ""), fs::current_path().string());
1259 }
1260
1261 InitSignatureCache();
1262 InitScriptExecutionCache();
1263
1264 LogPrintf("Using %u threads for script verification\n", nScriptCheckThreads);
1265 if (nScriptCheckThreads) {
1266 for (int i=0; i<nScriptCheckThreads-1; i++)
1267 threadGroup.create_thread(&ThreadScriptCheck);
1268 }
1269
1270 // Start the lightweight task scheduler thread
1271 CScheduler::Function serviceLoop = boost::bind(&CScheduler::serviceQueue, &scheduler);
1272 threadGroup.create_thread(boost::bind(&TraceThread<CScheduler::Function>, "scheduler", serviceLoop));
1273
1274 GetMainSignals().RegisterBackgroundSignalScheduler(scheduler);
1275 GetMainSignals().RegisterWithMempoolSignals(mempool);
1276
1277 /* Register RPC commands regardless of -server setting so they will be
1278 * available in the GUI RPC console even if external calls are disabled.
1279 */
1280 RegisterAllCoreRPCCommands(tableRPC);
1281 g_wallet_init_interface.RegisterRPC(tableRPC);
1282#if ENABLE_ZMQ
1283 RegisterZMQRPCCommands(tableRPC);

Callers 2

AppInitFunction · 0.85
appInitMainMethod · 0.85

Calls 15

CreatePidFileFunction · 0.85
GetPidFileFunction · 0.85
InitErrorFunction · 0.85
FormatISO8601DateTimeFunction · 0.85
GetTimeFunction · 0.85
GetDefaultDataDirFunction · 0.85
GetConfigFileFunction · 0.85
InitSignatureCacheFunction · 0.85
InitScriptExecutionCacheFunction · 0.85
RegisterZMQRPCCommandsFunction · 0.85
AppInitServersFunction · 0.85

Tested by

no test coverage detected