Avoid downloading the 700MB sprout-groth16 file we do not need

This commit is contained in:
Duke Leto
2019-07-05 01:19:02 -04:00
parent 9372a95d49
commit f6a4f17f82
6 changed files with 126 additions and 23 deletions

View File

@@ -755,12 +755,10 @@ static void ZC_LoadParams(
boost::filesystem::path sapling_spend = ZC_GetParamsDir() / "sapling-spend.params";
boost::filesystem::path sapling_output = ZC_GetParamsDir() / "sapling-output.params";
boost::filesystem::path sprout_groth16 = ZC_GetParamsDir() / "sprout-groth16.params";
if (!(
boost::filesystem::exists(sapling_spend) &&
boost::filesystem::exists(sapling_output) &&
boost::filesystem::exists(sprout_groth16)
boost::filesystem::exists(sapling_output)
)) {
uiInterface.ThreadSafeMessageBox(strprintf(
_("Cannot find the Zcash network parameters in the following directory:\n"
@@ -785,14 +783,11 @@ static void ZC_LoadParams(
auto sapling_spend_str = sapling_spend.native();
auto sapling_output_str = sapling_output.native();
auto sprout_groth16_str = sprout_groth16.native();
LogPrintf("Loading Sapling (Spend) parameters from %s\n", sapling_spend.string().c_str());
LogPrintf("Loading Sapling (Output) parameters from %s\n", sapling_output.string().c_str());
LogPrintf("Loading Sapling (Sprout Groth16) parameters from %s\n", sprout_groth16.string().c_str());
gettimeofday(&tv_start, 0);
// TODO: Unfortunately there is no way to initialize things without groth16, unless Rust code is modified.
librustzcash_init_zksnark_params(
reinterpret_cast<const codeunit*>(sapling_spend_str.c_str()),
sapling_spend_str.length(),
@@ -800,9 +795,10 @@ static void ZC_LoadParams(
reinterpret_cast<const codeunit*>(sapling_output_str.c_str()),
sapling_output_str.length(),
"657e3d38dbb5cb5e7dd2970e8b03d69b4787dd907285b5a7f0790dcc8072f60bf593b32cc2d1c030e00ff5ae64bf84c5c3beb84ddc841d48264b4a171744d028",
reinterpret_cast<const codeunit*>(sprout_groth16_str.c_str()),
sprout_groth16_str.length(),
"e9b238411bd6c0ec4791e9d04245ec350c9c5744f5610dfcce4365d5ca49dfefd5054e371842b3f88fa1b9d7e8e075249b3ebabd167fa8b0f3161292d36c180a"
// These are dummy arguments, ignored by Hush-flavored librustzcash
reinterpret_cast<const codeunit*>(sapling_output_str.c_str()),
sapling_output_str.length(),
"657e3d38dbb5cb5e7dd2970e8b03d69b4787dd907285b5a7f0790dcc8072f60bf593b32cc2d1c030e00ff5ae64bf84c5c3beb84ddc841d48264b4a171744d028"
);
gettimeofday(&tv_end, 0);