Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 3,082 Lines • ▼ Show 20 Lines | |||||
static UniValue loadwallet(const Config &config, | static UniValue loadwallet(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"loadwallet", | "loadwallet", | ||||
"Loads a wallet from a wallet file or directory." | "Loads a wallet from a wallet file or directory." | ||||
"\nNote that all wallet command-line options used when starting " | "\nNote that all wallet command-line options used when starting " | ||||
"bitcoind will be" | "bitcoind will be" | ||||
"\napplied to the new wallet (eg -zapwallettxes, upgradewallet, " | "\napplied to the new wallet (eg -zapwallettxes, rescan, etc).\n", | ||||
"rescan, etc).\n", | |||||
{ | { | ||||
{"filename", RPCArg::Type::STR, RPCArg::Optional::NO, | {"filename", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
"The wallet directory or .dat file."}, | "The wallet directory or .dat file."}, | ||||
}, | }, | ||||
RPCResult{"{\n" | RPCResult{"{\n" | ||||
" \"name\" : <wallet_name>, (string) The wallet " | " \"name\" : <wallet_name>, (string) The wallet " | ||||
"name if loaded successfully.\n" | "name if loaded successfully.\n" | ||||
" \"warning\" : <warning>, (string) Warning " | " \"warning\" : <warning>, (string) Warning " | ||||
▲ Show 20 Lines • Show All 1,428 Lines • ▼ Show 20 Lines | static UniValue sethdseed(const Config &config, const JSONRPCRequest &request) { | ||||
auto locked_chain = pwallet->chain().lock(); | auto locked_chain = pwallet->chain().lock(); | ||||
LOCK2(pwallet->cs_wallet, spk_man.cs_KeyStore); | LOCK2(pwallet->cs_wallet, spk_man.cs_KeyStore); | ||||
// Do not do anything to non-HD wallets | // Do not do anything to non-HD wallets | ||||
if (!pwallet->CanSupportFeature(FEATURE_HD)) { | if (!pwallet->CanSupportFeature(FEATURE_HD)) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_WALLET_ERROR, | RPC_WALLET_ERROR, | ||||
"Cannot set a HD seed on a non-HD wallet. Start with " | "Cannot set a HD seed on a non-HD wallet. Use the upgradewallet " | ||||
"-upgradewallet in order to upgrade a non-HD wallet to HD"); | "RPC in order to upgrade a non-HD wallet to HD"); | ||||
} | } | ||||
EnsureWalletIsUnlocked(pwallet); | EnsureWalletIsUnlocked(pwallet); | ||||
bool flush_key_pool = true; | bool flush_key_pool = true; | ||||
if (!request.params[0].isNull()) { | if (!request.params[0].isNull()) { | ||||
flush_key_pool = request.params[0].get_bool(); | flush_key_pool = request.params[0].get_bool(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 392 Lines • Show Last 20 Lines |