From d87f00c4d5e9f547481ccb3977febdc6f740828e Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 10 Jan 2017 16:33:41 +0100 Subject: [PATCH] Throw an error if zcash.conf is missing An empty zcash.conf is sufficient to bypass this error. --- src/util.cpp | 2 +- src/util.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/util.cpp b/src/util.cpp index b667acc5e..8fbdfc65b 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -534,7 +534,7 @@ void ReadConfigFile(map& mapSettingsRet, { boost::filesystem::ifstream streamConfig(GetConfigFile()); if (!streamConfig.good()) - return; // No zcash.conf file is OK + throw missing_zcash_conf(); set setOptions; setOptions.insert("*"); diff --git a/src/util.h b/src/util.h index ef3a347fa..b7d255e4d 100644 --- a/src/util.h +++ b/src/util.h @@ -127,6 +127,10 @@ boost::filesystem::path GetConfigFile(); boost::filesystem::path GetPidFile(); void CreatePidFile(const boost::filesystem::path &path, pid_t pid); #endif +class missing_zcash_conf : public std::runtime_error { +public: + missing_zcash_conf() : std::runtime_error("Missing zcash.conf") { } +}; void ReadConfigFile(std::map& mapSettingsRet, std::map >& mapMultiSettingsRet); #ifdef WIN32 boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate = true);