Try to lift requirement for sprout params
This commit is contained in:
15
src/init.cpp
15
src/init.cpp
@@ -1,5 +1,6 @@
|
|||||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||||
|
// Copyright (c) 2019 The Hush developers
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
@@ -752,15 +753,11 @@ static void ZC_LoadParams(
|
|||||||
struct timeval tv_start, tv_end;
|
struct timeval tv_start, tv_end;
|
||||||
float elapsed;
|
float elapsed;
|
||||||
|
|
||||||
boost::filesystem::path pk_path = ZC_GetParamsDir() / "sprout-proving.key";
|
|
||||||
boost::filesystem::path vk_path = ZC_GetParamsDir() / "sprout-verifying.key";
|
|
||||||
boost::filesystem::path sapling_spend = ZC_GetParamsDir() / "sapling-spend.params";
|
boost::filesystem::path sapling_spend = ZC_GetParamsDir() / "sapling-spend.params";
|
||||||
boost::filesystem::path sapling_output = ZC_GetParamsDir() / "sapling-output.params";
|
boost::filesystem::path sapling_output = ZC_GetParamsDir() / "sapling-output.params";
|
||||||
boost::filesystem::path sprout_groth16 = ZC_GetParamsDir() / "sprout-groth16.params";
|
boost::filesystem::path sprout_groth16 = ZC_GetParamsDir() / "sprout-groth16.params";
|
||||||
|
|
||||||
if (!(
|
if (!(
|
||||||
boost::filesystem::exists(pk_path) &&
|
|
||||||
boost::filesystem::exists(vk_path) &&
|
|
||||||
boost::filesystem::exists(sapling_spend) &&
|
boost::filesystem::exists(sapling_spend) &&
|
||||||
boost::filesystem::exists(sapling_output) &&
|
boost::filesystem::exists(sapling_output) &&
|
||||||
boost::filesystem::exists(sprout_groth16)
|
boost::filesystem::exists(sprout_groth16)
|
||||||
@@ -775,18 +772,17 @@ static void ZC_LoadParams(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogPrintf("Loading verifying key from %s\n", vk_path.string().c_str());
|
//LogPrintf("Loading verifying key from %s\n", vk_path.string().c_str());
|
||||||
gettimeofday(&tv_start, 0);
|
gettimeofday(&tv_start, 0);
|
||||||
|
|
||||||
pzcashParams = ZCJoinSplit::Prepared(vk_path.string(), pk_path.string());
|
//pzcashParams = ZCJoinSplit::Prepared(vk_path.string(), pk_path.string());
|
||||||
|
|
||||||
gettimeofday(&tv_end, 0);
|
gettimeofday(&tv_end, 0);
|
||||||
elapsed = float(tv_end.tv_sec-tv_start.tv_sec) + (tv_end.tv_usec-tv_start.tv_usec)/float(1000000);
|
elapsed = float(tv_end.tv_sec-tv_start.tv_sec) + (tv_end.tv_usec-tv_start.tv_usec)/float(1000000);
|
||||||
LogPrintf("Loaded verifying key in %fs seconds.\n", elapsed);
|
LogPrintf("Loaded verifying key in %fs seconds.\n", elapsed);
|
||||||
|
|
||||||
static_assert(
|
static_assert( sizeof(boost::filesystem::path::value_type) == sizeof(codeunit), "librustzcash not configured correctly");
|
||||||
sizeof(boost::filesystem::path::value_type) == sizeof(codeunit),
|
|
||||||
"librustzcash not configured correctly");
|
|
||||||
auto sapling_spend_str = sapling_spend.native();
|
auto sapling_spend_str = sapling_spend.native();
|
||||||
auto sapling_output_str = sapling_output.native();
|
auto sapling_output_str = sapling_output.native();
|
||||||
auto sprout_groth16_str = sprout_groth16.native();
|
auto sprout_groth16_str = sprout_groth16.native();
|
||||||
@@ -796,6 +792,7 @@ static void ZC_LoadParams(
|
|||||||
LogPrintf("Loading Sapling (Sprout Groth16) parameters from %s\n", sprout_groth16.string().c_str());
|
LogPrintf("Loading Sapling (Sprout Groth16) parameters from %s\n", sprout_groth16.string().c_str());
|
||||||
gettimeofday(&tv_start, 0);
|
gettimeofday(&tv_start, 0);
|
||||||
|
|
||||||
|
// TODO: Unfortunately there is no way to initialize things without groth16, unless Rust code is modified.
|
||||||
librustzcash_init_zksnark_params(
|
librustzcash_init_zksnark_params(
|
||||||
reinterpret_cast<const codeunit*>(sapling_spend_str.c_str()),
|
reinterpret_cast<const codeunit*>(sapling_spend_str.c_str()),
|
||||||
sapling_spend_str.length(),
|
sapling_spend_str.length(),
|
||||||
|
|||||||
Reference in New Issue
Block a user