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.");