比特币源码阅读(0.16)(十三) 发表于 2018-04-18 | 阅读次数: CWallet::CreateWalletFromFile如果编译宏ENABLE_WALLET打开(缺省),并且命令行参数-disablewallet没有设置,则从-wallet输入参数指定的文件中加载钱包数据,缺省是wallet.dat 12345678910111213141516171819202122232425// ********************************************************* Step 8: load wallet#ifdef ENABLE_WALLET if (!OpenWallets()) return false;#else LogPrintf("No wallet support compiled in!\n");#endifbool OpenWallets(){ if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) { LogPrintf("Wallet disabled!\n"); return true; } for (const std::string& walletFile : gArgs.GetArgs("-wallet")) { CWallet * const pwallet = CWallet::CreateWalletFromFile(walletFile); if (!pwallet) { return false; } vpwallets.push_back(pwallet); } return true;}