创建钱包
创建钱包
创建钱包整体流程
std::string wallet_name = request.params[0].get_str(); std::string error; std::string warning;bool disable_privatekeys = false; if (!request.params[1].isNull()) { disable_privatekeys = request.params[1].get_bool(); }fs::path wallet_path = fs::absolute(wallet_name, GetWalletDir()); if (fs::symlink_status(wallet_path).type() != fs::file_not_found) { throw JSONRPCError(RPC_WALLET_ERROR, "Wallet " + wallet_name + " already exists."); }if (!CWallet::Verify(wallet_name, false, error, warning)) { throw JSONRPCError(RPC_WALLET_ERROR, "Wallet file verification failed: " + error); }std::shared_ptr<CWallet> const wallet = CWallet::CreateWalletFromFile(wallet_name, fs::absolute(wallet_name, GetWalletDir()), (disable_privatekeys ? (uint64_t)WALLET_FLAG_DISABLE_PRIVATE_KEYS : 0)); if (!wallet) { throw JSONRPCError(RPC_WALLET_ERROR, "Wallet creation failed."); }
1、CreateWalletFromFile 创建钱包入口
后记

Last updated

