Load proving/verifying keys at startup from the public alpha parameters file.
This commit is contained in:
43
src/init.cpp
43
src/init.cpp
@@ -49,6 +49,8 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
libzerocash::ZerocashParams *pzerocashParams = NULL;
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
CWallet* pwalletMain = NULL;
|
||||
#endif
|
||||
@@ -591,6 +593,44 @@ bool InitSanityCheck(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static void ZC_LoadParams()
|
||||
{
|
||||
struct timeval tv_start, tv_end;
|
||||
float elapsed;
|
||||
|
||||
boost::filesystem::path pk_path = ZC_GetParamsDir() / "zc-testnet-public-alpha-proving.key";
|
||||
boost::filesystem::path vk_path = ZC_GetParamsDir() / "zc-testnet-public-alpha-verification.key";
|
||||
|
||||
LogPrintf("Loading proving key from %s\n", pk_path.string().c_str());
|
||||
gettimeofday(&tv_start, 0);
|
||||
libzerocash::ZerocashParams::zerocash_pp::init_public_params();
|
||||
auto pk_loaded = libzerocash::ZerocashParams::LoadProvingKeyFromFile(
|
||||
pk_path.string(),
|
||||
INCREMENTAL_MERKLE_TREE_DEPTH
|
||||
);
|
||||
gettimeofday(&tv_end, 0);
|
||||
elapsed = float(tv_end.tv_sec-tv_start.tv_sec) + (tv_end.tv_usec-tv_start.tv_usec)/float(1000000);
|
||||
LogPrintf("Loaded proving key in %fs seconds.\n", elapsed);
|
||||
|
||||
|
||||
LogPrintf("Loading verification key from %s\n", vk_path.string().c_str());
|
||||
gettimeofday(&tv_start, 0);
|
||||
auto vk_loaded = libzerocash::ZerocashParams::LoadVerificationKeyFromFile(
|
||||
vk_path.string(),
|
||||
INCREMENTAL_MERKLE_TREE_DEPTH
|
||||
);
|
||||
gettimeofday(&tv_end, 0);
|
||||
elapsed = float(tv_end.tv_sec-tv_start.tv_sec) + (tv_end.tv_usec-tv_start.tv_usec)/float(1000000);
|
||||
LogPrintf("Loaded verification key in %fs seconds.\n", elapsed);
|
||||
|
||||
pzerocashParams = new libzerocash::ZerocashParams(
|
||||
INCREMENTAL_MERKLE_TREE_DEPTH,
|
||||
&pk_loaded,
|
||||
&vk_loaded
|
||||
);
|
||||
}
|
||||
|
||||
/** Initialize bitcoin.
|
||||
* @pre Parameters should be parsed and config file should be read.
|
||||
*/
|
||||
@@ -1223,6 +1263,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
mempool.ReadFeeEstimates(est_filein);
|
||||
fFeeEstimatesInitialized = true;
|
||||
|
||||
// ********************************************************* Step 7i: Load zcash params
|
||||
ZC_LoadParams();
|
||||
|
||||
// ********************************************************* Step 8: load wallet
|
||||
#ifdef ENABLE_WALLET
|
||||
if (fDisableWallet) {
|
||||
|
||||
Reference in New Issue
Block a user