Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 3,403 Lines • ▼ Show 20 Lines | UniValue loadwallet(const Config &config, const JSONRPCRequest &request) { | ||||
UniValue obj(UniValue::VOBJ); | UniValue obj(UniValue::VOBJ); | ||||
obj.pushKV("name", wallet->GetName()); | obj.pushKV("name", wallet->GetName()); | ||||
obj.pushKV("warning", warning); | obj.pushKV("warning", warning); | ||||
return obj; | return obj; | ||||
} | } | ||||
UniValue createwallet(const JSONRPCRequest& request) | UniValue createwallet(const Config &config, const JSONRPCRequest &request) { | ||||
deadalnix: grep -r ~/bitcoin-abc/src/ -e createwallet
Gives me nothing, so it doesn't look like this… | |||||
{ | if (request.fHelp || request.params.size() != 1) { | ||||
if (request.fHelp || request.params.size() != 1) | |||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"createwallet \"wallet_name\"\n" | "createwallet \"wallet_name\"\n" | ||||
"\nCreates and loads a new wallet.\n" | "\nCreates and loads a new wallet.\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"wallet_name\" (string, required) The name for the new wallet.\n" | "1. \"wallet_name\" (string, required) The name for the new " | ||||
"wallet. If this is a path, the wallet will be created at the path " | |||||
"location.\n" | |||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"name\" : <wallet_name>, (string) The wallet name if created successfully.\n" | " \"name\" : <wallet_name>, (string) The wallet name if " | ||||
" \"warning\" : <warning>, (string) Warning message if wallet was not loaded cleanly.\n" | "created successfully. If the wallet was created using a full " | ||||
"path, the wallet_name will be the full path.\n" | |||||
" \"warning\" : <warning>, (string) Warning message if " | |||||
"wallet was not loaded cleanly.\n" | |||||
"}\n" | "}\n" | ||||
"\nExamples:\n" | "\nExamples:\n" + | ||||
+ HelpExampleCli("createwallet", "\"test.dat\"") | HelpExampleCli("createwallet", "\"testwallet\"") + | ||||
+ HelpExampleRpc("createwallet", "\"test.dat\"") | HelpExampleRpc("createwallet", "\"testwallet\"")); | ||||
); | } | ||||
const CChainParams &chainParams = config.GetChainParams(); | |||||
std::string wallet_name = request.params[0].get_str(); | std::string wallet_name = request.params[0].get_str(); | ||||
std::string error; | std::string error; | ||||
std::string warning; | std::string warning; | ||||
fs::path wallet_path = fs::absolute(wallet_name, GetWalletDir()); | fs::path wallet_path = fs::absolute(wallet_name, GetWalletDir()); | ||||
if (fs::symlink_status(wallet_path).type() != fs::file_not_found) { | if (fs::symlink_status(wallet_path).type() != fs::file_not_found) { | ||||
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet " + wallet_name + " already exists."); | throw JSONRPCError(RPC_WALLET_ERROR, | ||||
"Wallet " + wallet_name + " already exists."); | |||||
} | } | ||||
// Wallet::Verify will check if we're trying to create a wallet with a duplication name. | // Wallet::Verify will check if we're trying to create a wallet with a | ||||
if (!CWallet::Verify(wallet_name, false, error, warning)) { | // duplication name. | ||||
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet file verification failed: " + error); | if (!CWallet::Verify(chainParams, 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())); | std::shared_ptr<CWallet> const wallet = CWallet::CreateWalletFromFile( | ||||
chainParams, wallet_name, fs::absolute(wallet_name, GetWalletDir())); | |||||
if (!wallet) { | if (!wallet) { | ||||
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet creation failed."); | throw JSONRPCError(RPC_WALLET_ERROR, "Wallet creation failed."); | ||||
} | } | ||||
AddWallet(wallet); | AddWallet(wallet); | ||||
wallet->postInitProcess(); | wallet->postInitProcess(); | ||||
UniValue obj(UniValue::VOBJ); | UniValue obj(UniValue::VOBJ); | ||||
▲ Show 20 Lines • Show All 1,050 Lines • ▼ Show 20 Lines | |||||
static const ContextFreeRPCCommand commands[] = { | static const ContextFreeRPCCommand commands[] = { | ||||
// category name actor (function) argNames | // category name actor (function) argNames | ||||
// ------------------- ------------------------ ---------------------- ---------- | // ------------------- ------------------------ ---------------------- ---------- | ||||
{ "rawtransactions", "fundrawtransaction", fundrawtransaction, {"hexstring","options"} }, | { "rawtransactions", "fundrawtransaction", fundrawtransaction, {"hexstring","options"} }, | ||||
{ "hidden", "resendwallettransactions", resendwallettransactions, {} }, | { "hidden", "resendwallettransactions", resendwallettransactions, {} }, | ||||
{ "wallet", "abandontransaction", abandontransaction, {"txid"} }, | { "wallet", "abandontransaction", abandontransaction, {"txid"} }, | ||||
{ "wallet", "addmultisigaddress", addmultisigaddress, {"nrequired","keys","label|account"} }, | { "wallet", "addmultisigaddress", addmultisigaddress, {"nrequired","keys","label|account"} }, | ||||
{ "wallet", "backupwallet", backupwallet, {"destination"} }, | { "wallet", "backupwallet", backupwallet, {"destination"} }, | ||||
{ "wallet", "createwallet", createwallet, {"filename"} }, | { "wallet", "createwallet", createwallet, {"wallet_name"} }, | ||||
{ "wallet", "encryptwallet", encryptwallet, {"passphrase"} }, | { "wallet", "encryptwallet", encryptwallet, {"passphrase"} }, | ||||
{ "wallet", "getaccountaddress", getlabeladdress, {"account"} }, | { "wallet", "getaccountaddress", getlabeladdress, {"account"} }, | ||||
{ "wallet", "getlabeladdress", getlabeladdress, {"label"} }, | { "wallet", "getlabeladdress", getlabeladdress, {"label"} }, | ||||
{ "wallet", "getaccount", getaccount, {"address"} }, | { "wallet", "getaccount", getaccount, {"address"} }, | ||||
{ "wallet", "getaddressesbyaccount", getaddressesbyaccount, {"account"} }, | { "wallet", "getaddressesbyaccount", getaddressesbyaccount, {"account"} }, | ||||
{ "wallet", "getaddressinfo", getaddressinfo, {"address"} }, | { "wallet", "getaddressinfo", getaddressinfo, {"address"} }, | ||||
{ "wallet", "getbalance", getbalance, {"account","minconf","include_watchonly"} }, | { "wallet", "getbalance", getbalance, {"account","minconf","include_watchonly"} }, | ||||
{ "wallet", "getnewaddress", getnewaddress, {"label|account", "address_type"} }, | { "wallet", "getnewaddress", getnewaddress, {"label|account", "address_type"} }, | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |
Gives me nothing, so it doesn't look like this patch is applicable to anything.