make librustzcash_init_zksnark_params idempotent
This commit is contained in:
parent
13351ff31d
commit
0e6b004a64
|
@ -29,6 +29,7 @@ use std::fs::File;
|
|||
use std::io::BufReader;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::slice;
|
||||
use std::sync::Once;
|
||||
use subtle::CtOption;
|
||||
use tracing::{error, info};
|
||||
|
||||
|
@ -84,6 +85,7 @@ mod test_harness_ffi;
|
|||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
static PROOF_PARAMETERS_LOADED: Once = Once::new();
|
||||
static mut SAPLING_SPEND_VK: Option<PreparedVerifyingKey<Bls12>> = None;
|
||||
static mut SAPLING_OUTPUT_VK: Option<PreparedVerifyingKey<Bls12>> = None;
|
||||
static mut SPROUT_GROTH16_VK: Option<PreparedVerifyingKey<Bls12>> = None;
|
||||
|
@ -127,6 +129,7 @@ pub extern "C" fn librustzcash_init_zksnark_params(
|
|||
#[cfg(target_os = "windows")] sprout_path: *const u16,
|
||||
sprout_path_len: usize,
|
||||
) {
|
||||
PROOF_PARAMETERS_LOADED.call_once(|| {
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
let (spend_path, output_path, sprout_path) = {
|
||||
(
|
||||
|
@ -185,6 +188,7 @@ pub extern "C" fn librustzcash_init_zksnark_params(
|
|||
ORCHARD_PK = Some(orchard_pk);
|
||||
ORCHARD_VK = Some(orchard_vk);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Writes the "uncommitted" note value for empty leaves of the Merkle tree.
|
||||
|
|
Loading…
Reference in New Issue