@@ -1980,9 +1980,17 @@ Value encryptwallet(const Array& params, bool fHelp)
|
|||||||
if (!EnsureWalletIsAvailable(fHelp))
|
if (!EnsureWalletIsAvailable(fHelp))
|
||||||
return Value::null;
|
return Value::null;
|
||||||
|
|
||||||
|
auto fEnableWalletEncryption = GetBoolArg("-developerencryptwallet", false);
|
||||||
|
|
||||||
|
std::string strWalletEncryptionDisabledMsg = "";
|
||||||
|
if (!fEnableWalletEncryption) {
|
||||||
|
strWalletEncryptionDisabledMsg = "\nWARNING: Wallet encryption is DISABLED. This call does nothing.\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (!pwalletMain->IsCrypted() && (fHelp || params.size() != 1))
|
if (!pwalletMain->IsCrypted() && (fHelp || params.size() != 1))
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"encryptwallet \"passphrase\"\n"
|
"encryptwallet \"passphrase\"\n"
|
||||||
|
+ strWalletEncryptionDisabledMsg +
|
||||||
"\nEncrypts the wallet with 'passphrase'. This is for first time encryption.\n"
|
"\nEncrypts the wallet with 'passphrase'. This is for first time encryption.\n"
|
||||||
"After this, any calls that interact with private keys such as sending or signing \n"
|
"After this, any calls that interact with private keys such as sending or signing \n"
|
||||||
"will require the passphrase to be set prior the making these calls.\n"
|
"will require the passphrase to be set prior the making these calls.\n"
|
||||||
@@ -2008,6 +2016,9 @@ Value encryptwallet(const Array& params, bool fHelp)
|
|||||||
|
|
||||||
if (fHelp)
|
if (fHelp)
|
||||||
return true;
|
return true;
|
||||||
|
if (!fEnableWalletEncryption) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (pwalletMain->IsCrypted())
|
if (pwalletMain->IsCrypted())
|
||||||
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an encrypted wallet, but encryptwallet was called.");
|
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an encrypted wallet, but encryptwallet was called.");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user