Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 2,322 Lines • ▼ Show 20 Lines | static UniValue walletpassphrase(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (pwallet->IsCrypted() && (request.fHelp || request.params.size() != 2)) { | if (request.fHelp || request.params.size() != 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"walletpassphrase", | "walletpassphrase", | ||||
"\nStores the wallet decryption key in memory for 'timeout' " | "\nStores the wallet decryption key in memory for 'timeout' " | ||||
"seconds.\n" | "seconds.\n" | ||||
"This is needed prior to performing transactions related to " | "This is needed prior to performing transactions related to " | ||||
"private keys such as sending bitcoins\n" | "private keys such as sending bitcoins\n" | ||||
"\nNote:\n" | "\nNote:\n" | ||||
"Issuing the walletpassphrase command while the wallet is already " | "Issuing the walletpassphrase command while the wallet is already " | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | static UniValue walletpassphrasechange(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (pwallet->IsCrypted() && (request.fHelp || request.params.size() != 2)) { | if (request.fHelp || request.params.size() != 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"walletpassphrasechange", | "walletpassphrasechange", | ||||
"\nChanges the wallet passphrase from 'oldpassphrase' to " | "\nChanges the wallet passphrase from 'oldpassphrase' to " | ||||
"'newpassphrase'.\n", | "'newpassphrase'.\n", | ||||
{ | { | ||||
{"oldpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, | {"oldpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
"The current passphrase"}, | "The current passphrase"}, | ||||
{"newpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, | {"newpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | static UniValue walletlock(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (pwallet->IsCrypted() && (request.fHelp || request.params.size() != 0)) { | if (request.fHelp || request.params.size() != 0) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"walletlock", | "walletlock", | ||||
"\nRemoves the wallet encryption key from memory, locking the " | "\nRemoves the wallet encryption key from memory, locking the " | ||||
"wallet.\n" | "wallet.\n" | ||||
"After calling this method, you will need to call walletpassphrase " | "After calling this method, you will need to call walletpassphrase " | ||||
"again\n" | "again\n" | ||||
"before being able to call any methods which require the wallet to " | "before being able to call any methods which require the wallet to " | ||||
"be unlocked.\n", | "be unlocked.\n", | ||||
Show All 36 Lines | static UniValue encryptwallet(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (!pwallet->IsCrypted() && | if (request.fHelp || request.params.size() != 1) { | ||||
(request.fHelp || request.params.size() != 1)) { | |||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"encryptwallet", | "encryptwallet", | ||||
"\nEncrypts the wallet with 'passphrase'. This is for first time " | "\nEncrypts the wallet with 'passphrase'. This is for first time " | ||||
"encryption.\n" | "encryption.\n" | ||||
"After this, any calls that interact with private keys such as " | "After this, any calls that interact with private keys such as " | ||||
"sending or signing \n" | "sending or signing \n" | ||||
"will require the passphrase to be set prior the making these " | "will require the passphrase to be set prior the making these " | ||||
"calls.\n" | "calls.\n" | ||||
▲ Show 20 Lines • Show All 2,448 Lines • Show Last 20 Lines |