Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 3,137 Lines • ▼ Show 20 Lines | if (!location.Exists()) { | ||||
"Directory " + location.GetName() + | "Directory " + location.GetName() + | ||||
" does not contain a wallet.dat file."); | " does not contain a wallet.dat file."); | ||||
} | } | ||||
} | } | ||||
bilingual_str error; | bilingual_str error; | ||||
std::vector<bilingual_str> warnings; | std::vector<bilingual_str> warnings; | ||||
std::shared_ptr<CWallet> const wallet = | std::shared_ptr<CWallet> const wallet = | ||||
LoadWallet(chainParams, *context.chain, location, error, warnings); | LoadWallet(*context.chain, location, error, warnings); | ||||
if (!wallet) { | if (!wallet) { | ||||
throw JSONRPCError(RPC_WALLET_ERROR, error.original); | throw JSONRPCError(RPC_WALLET_ERROR, error.original); | ||||
} | } | ||||
UniValue obj(UniValue::VOBJ); | UniValue obj(UniValue::VOBJ); | ||||
obj.pushKV("name", wallet->GetName()); | obj.pushKV("name", wallet->GetName()); | ||||
obj.pushKV("warning", Join(warnings, Untranslated("\n")).original); | obj.pushKV("warning", Join(warnings, Untranslated("\n")).original); | ||||
▲ Show 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | if (!request.params[5].isNull() && request.params[5].get_bool()) { | ||||
flags |= WALLET_FLAG_DESCRIPTORS; | flags |= WALLET_FLAG_DESCRIPTORS; | ||||
warnings.emplace_back( | warnings.emplace_back( | ||||
Untranslated("Wallet is an experimental descriptor wallet")); | Untranslated("Wallet is an experimental descriptor wallet")); | ||||
} | } | ||||
bilingual_str error; | bilingual_str error; | ||||
std::shared_ptr<CWallet> wallet; | std::shared_ptr<CWallet> wallet; | ||||
WalletCreationStatus status = | WalletCreationStatus status = | ||||
CreateWallet(config.GetChainParams(), *context.chain, passphrase, flags, | CreateWallet(*context.chain, passphrase, flags, | ||||
request.params[0].get_str(), error, warnings, wallet); | request.params[0].get_str(), error, warnings, wallet); | ||||
switch (status) { | switch (status) { | ||||
case WalletCreationStatus::CREATION_FAILED: | case WalletCreationStatus::CREATION_FAILED: | ||||
throw JSONRPCError(RPC_WALLET_ERROR, error.original); | throw JSONRPCError(RPC_WALLET_ERROR, error.original); | ||||
case WalletCreationStatus::ENCRYPTION_FAILED: | case WalletCreationStatus::ENCRYPTION_FAILED: | ||||
throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, error.original); | throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, error.original); | ||||
case WalletCreationStatus::SUCCESS: | case WalletCreationStatus::SUCCESS: | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 1,665 Lines • Show Last 20 Lines |