以上貼出比特幣核心配置。比如說難度值最小不能小于多少,多久時間出塊等等。
接著往下看其他初始化函數.
if (!gArgs.ReadConfigFiles(error, true)) {
? ? ? ? ? ? fprintf(stderr, "Error reading configuration file: %s\n", error.c_str());
? ? ? ? ? ? return false;
? ? ? ? }
從配置文件里面讀取配置信息,這也不開展了。
? ? ? ? ? ? InitLogging();初始化日志
? ? ? ? InitParameterInteraction();
這個函數里面判斷一些配置是否設置了。然后輸入日志里面,比如說upnp代理proxy等等
將加載后的參數封裝在gArgs這個對象中。使用這個對象初始化其他內容。
AppInitBasicSetup{
SetupNetworking//這個初始化網絡參數,
registerSignalHandler
}
AppInitSanityChecks像這個函數就是初始化隨機數產生和SPECK2561加密算法類
以上就差不多設置完成了
然后可以開始正式的程序
fprintf(stdout, "Bitcoin server starting\n");
開始主程序錢還得加個
if (!AppInitLockDataDirectory())
? ? ? ? {
? ? ? ? ? ? // If locking the data directory failed, exit immediately
? ? ? ? ? ? return false;
? ? ? ? }
fRet = AppInitMain(interfaces);
好了這個函數相當長,————end