Throw an error when encryptwallet is disabled

This commit is contained in:
Jack Grigg
2016-10-20 12:58:20 -05:00
parent 62c0aa9e58
commit 1532cb75f3

View File

@@ -1984,7 +1984,7 @@ Value encryptwallet(const Array& params, bool fHelp)
std::string strWalletEncryptionDisabledMsg = "";
if (!fEnableWalletEncryption) {
strWalletEncryptionDisabledMsg = "\nWARNING: Wallet encryption is DISABLED. This call does nothing.\n";
strWalletEncryptionDisabledMsg = "\nWARNING: Wallet encryption is DISABLED. This call always fails.\n";
}
if (!pwalletMain->IsCrypted() && (fHelp || params.size() != 1))
@@ -2017,7 +2017,7 @@ Value encryptwallet(const Array& params, bool fHelp)
if (fHelp)
return true;
if (!fEnableWalletEncryption) {
return false;
throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, "Error: wallet encryption is disabled.");
}
if (pwalletMain->IsCrypted())
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an encrypted wallet, but encryptwallet was called.");