Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 3,256 Lines • ▼ Show 20 Lines | if (!pwallet->IsCrypted() && | ||||
"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" | ||||
"Use the walletpassphrase call for this, and then walletlock " | "Use the walletpassphrase call for this, and then walletlock " | ||||
"call.\n" | "call.\n" | ||||
"If the wallet is already encrypted, use the " | "If the wallet is already encrypted, use the " | ||||
"walletpassphrasechange call.\n" | "walletpassphrasechange call.\n" | ||||
"Note that this will shutdown the server.\n" | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"passphrase\" (string) The pass phrase to encrypt the " | "1. \"passphrase\" (string) The pass phrase to encrypt the " | ||||
"wallet with. It must be at least 1 character, but should be " | "wallet with. It must be at least 1 character, but should be " | ||||
"long.\n" | "long.\n" | ||||
"\nExamples:\n" | "\nExamples:\n" | ||||
"\nEncrypt your wallet\n" + | "\nEncrypt your wallet\n" + | ||||
HelpExampleCli("encryptwallet", "\"my pass phrase\"") + | HelpExampleCli("encryptwallet", "\"my pass phrase\"") + | ||||
"\nNow set the passphrase to use the wallet, such as for signing " | "\nNow set the passphrase to use the wallet, such as for signing " | ||||
Show All 30 Lines | if (strWalletPass.length() < 1) { | ||||
"Encrypts the wallet with <passphrase>."); | "Encrypts the wallet with <passphrase>."); | ||||
} | } | ||||
if (!pwallet->EncryptWallet(strWalletPass)) { | if (!pwallet->EncryptWallet(strWalletPass)) { | ||||
throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, | throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, | ||||
"Error: Failed to encrypt the wallet."); | "Error: Failed to encrypt the wallet."); | ||||
} | } | ||||
// BDB seems to have a bad habit of writing old data into | return "wallet encrypted; The keypool has been flushed and a new HD seed " | ||||
// slack space in .dat files; that is bad if the old data is | |||||
// unencrypted private keys. So: | |||||
StartShutdown(); | |||||
return "wallet encrypted; Bitcoin server stopping, restart to run with " | |||||
"encrypted wallet. The keypool has been flushed and a new HD seed " | |||||
"was generated (if you are using HD). You need to make a new " | "was generated (if you are using HD). You need to make a new " | ||||
"backup."; | "backup."; | ||||
} | } | ||||
static UniValue lockunspent(const Config &config, | static UniValue lockunspent(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(); | ||||
▲ Show 20 Lines • Show All 2,138 Lines • Show Last 20 Lines |