Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 3,178 Lines • ▼ Show 20 Lines | static UniValue createwallet(const Config &config, | ||||
if (!request.params[4].isNull() && request.params[4].get_bool()) { | if (!request.params[4].isNull() && request.params[4].get_bool()) { | ||||
flags |= WALLET_FLAG_AVOID_REUSE; | flags |= WALLET_FLAG_AVOID_REUSE; | ||||
} | } | ||||
std::string error; | std::string error; | ||||
std::string warning; | std::string warning; | ||||
WalletCreationStatus status; | WalletCreationStatus status; | ||||
std::shared_ptr<CWallet> wallet = CreateWallet( | std::shared_ptr<CWallet> wallet = | ||||
config.GetChainParams(), *g_rpc_chain, request.params[0].get_str(), | CreateWallet(config.GetChainParams(), *g_rpc_chain, passphrase, flags, | ||||
error, warning, status, passphrase, flags); | request.params[0].get_str(), error, warning, status); | ||||
if (status == WalletCreationStatus::CREATION_FAILED) { | if (status == WalletCreationStatus::CREATION_FAILED) { | ||||
throw JSONRPCError(RPC_WALLET_ERROR, error); | throw JSONRPCError(RPC_WALLET_ERROR, error); | ||||
} else if (status == WalletCreationStatus::ENCRYPTION_FAILED) { | } else if (status == WalletCreationStatus::ENCRYPTION_FAILED) { | ||||
throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, error); | throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, error); | ||||
} else if (status != WalletCreationStatus::SUCCESS) { | } else if (status != WalletCreationStatus::SUCCESS) { | ||||
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet creation failed"); | throw JSONRPCError(RPC_WALLET_ERROR, "Wallet creation failed"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,531 Lines • Show Last 20 Lines |