第四步:应用程序初始化
第4步,检查相关的加密函数(src/bitcoind.cpp)
src/bitcoind.cpp)第4a 步,应用程序初始化(src/init.cpp::AppInitMain())
src/init.cpp::AppInitMain())if (g_logger->m_print_to_file) { if (gArgs.GetBoolArg("-shrinkdebugfile", g_logger->DefaultShrinkDebugFile())) { // Do this first since it both loads a bunch of debug.log into memory, // and because this needs to happen before any other debug.log printing g_logger->ShrinkDebugFile(); } if (!g_logger->OpenDebugLog()) { return InitError(strprintf("Could not open debug log file %s", g_logger->m_file_path.string())); } }if (nScriptCheckThreads) { for (int i=0; i<nScriptCheckThreads-1; i++) threadGroup.create_thread(&ThreadScriptCheck); }CScheduler::Function serviceLoop = boost::bind(&CScheduler::serviceQueue, &scheduler); threadGroup.create_thread(boost::bind(&TraceThread<CScheduler::Function>, "scheduler", serviceLoop));GetMainSignals().RegisterBackgroundSignalScheduler(scheduler);m_internals.reset(new MainSignalsInstance(&scheduler));void CMainSignals::RegisterWithMempoolSignals(CTxMemPool& pool) { pool.NotifyEntryRemoved.connect(boost::bind(&CMainSignals::MempoolEntryRemoved, this, _1, _2)); }./src/bitcoin-cli -regtest createwallet test./src/bitcoin-cli -regtest -rpcwallet= getwalletinfo ./src/bitcoin-cli -regtest -rpcwallet=test getwalletinfo./src/bitcoin-cli -regtest -rpcwallet=test getnewaddress
if (gArgs.GetBoolArg("-server", false)) { uiInterface.InitMessage_connect(SetRPCWarmupStatus); if (!AppInitServers()) return InitError(_("Unable to start HTTP server. See debug log for details.")); }static void OnRPCStarted() { uiInterface.NotifyBlockTip_connect(&RPCNotifyBlockChange); }static void OnRPCStopped() { uiInterface.NotifyBlockTip_disconnect(&RPCNotifyBlockChange); RPCNotifyBlockChange(false, nullptr); g_best_block_cv.notify_all(); LogPrint(BCLog::RPC, "RPC stopped.\n"); }if (!InitHTTPServer()) return false;if (!StartHTTPRPC()) return false;void StartHTTPServer() { LogPrint(BCLog::HTTP, "Starting HTTP server\n"); int rpcThreads = std::max((long)gArgs.GetArg("-rpcthreads", DEFAULT_HTTP_THREADS), 1L); LogPrintf("HTTP: starting %d worker threads\n", rpcThreads); std::packaged_task<bool(event_base*)> task(ThreadHTTP); threadResult = task.get_future(); threadHTTP = std::thread(std::move(task), eventBase); for (int i = 0; i < rpcThreads; i++) { g_thread_http_workers.emplace_back(HTTPWorkQueueRun, workQueue); } }
Last updated