Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 3,177 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; | std::shared_ptr<CWallet> wallet; | ||||
std::shared_ptr<CWallet> wallet = | WalletCreationStatus status = | ||||
CreateWallet(config.GetChainParams(), *g_rpc_chain, passphrase, flags, | CreateWallet(config.GetChainParams(), *g_rpc_chain, passphrase, flags, | ||||
request.params[0].get_str(), error, warning, status); | request.params[0].get_str(), error, warning, wallet); | ||||
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 |