Skip to content

Commit

Permalink
Auto merge of #1665 - bitbandi:master, r=daira
Browse files Browse the repository at this point in the history
Allow to configure the zk-SNARK parameters directory using `-paramsdir=`

same use as datadir=/foo/bar parameter
  • Loading branch information
zkbot committed Aug 14, 2020
2 parents 95a27e9 + 1bd4d23 commit b3407f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ std::string HelpMessage(HelpMessageMode mode)
#endif
}
strUsage += HelpMessageOpt("-datadir=<dir>", _("Specify data directory"));
strUsage += HelpMessageOpt("-paramsdir=<dir>", _("Specify Zcash network parameters directory"));
strUsage += HelpMessageOpt("-dbcache=<n>", strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"), nMinDbCache, nMaxDbCache, nDefaultDbCache));
strUsage += HelpMessageOpt("-debuglogfile=<file>", 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=<dir>", _("Specify directory to be used when exporting data"));
Expand Down
11 changes: 9 additions & 2 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit b3407f0

Please sign in to comment.