From 62c0aa9e58eb0dd9a22a2a83fd01d854d575a184 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 18 Oct 2016 17:47:17 -0500 Subject: [PATCH] Disable wallet encryption Closes #1552 --- src/wallet/rpcwallet.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 4d6608570..eb76e667d 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1979,10 +1979,18 @@ Value encryptwallet(const Array& params, bool fHelp) { if (!EnsureWalletIsAvailable(fHelp)) 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)) throw runtime_error( "encryptwallet \"passphrase\"\n" + + strWalletEncryptionDisabledMsg + "\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" "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) return true; + if (!fEnableWalletEncryption) { + return false; + } if (pwalletMain->IsCrypted()) throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an encrypted wallet, but encryptwallet was called.");