diff --git a/src/init.cpp b/src/init.cpp
index 317216ae4..4a0cc222f 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -340,6 +340,7 @@ std::string HelpMessage(HelpMessageMode mode)
#endif
}
strUsage += HelpMessageOpt("-datadir=
", _("Specify data directory"));
+ strUsage += HelpMessageOpt("-paramsdir=", _("Specify Zcash network parameters directory"));
strUsage += HelpMessageOpt("-dbcache=", strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"), nMinDbCache, nMaxDbCache, nDefaultDbCache));
strUsage += HelpMessageOpt("-debuglogfile=", strprintf(_("Specify location of debug log file: this can be an absolute path or a path relative to the data directory (default: %s)"), DEFAULT_DEBUGLOGFILE));
strUsage += HelpMessageOpt("-exportdir=", _("Specify directory to be used when exporting data"));
diff --git a/src/util.cpp b/src/util.cpp
index dc0ecd0ff..9d77cd5dc 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -431,7 +431,7 @@ static boost::filesystem::path pathCachedNetSpecific;
static boost::filesystem::path zc_paramsPathCached;
static CCriticalSection csPathCached;
-static boost::filesystem::path ZC_GetBaseParamsDir()
+static boost::filesystem::path ZC_GetDefaultBaseParamsDir()
{
// Copied from GetDefaultDataDir and adapter for zcash params.
@@ -475,7 +475,14 @@ const boost::filesystem::path &ZC_GetParamsDir()
if (!path.empty())
return path;
- path = ZC_GetBaseParamsDir();
+ if (mapArgs.count("-paramsdir")) {
+ path = fs::system_complete(mapArgs["-paramsdir"]);
+ if (!fs::is_directory(path)) {
+ throw std::runtime_error(strprintf("The -paramsdir '%s' does not exist or is not a directory", path.string()));
+ }
+ } else {
+ path = ZC_GetDefaultBaseParamsDir();
+ }
return path;
}