pass crh parameters into commitment merkle path verify method

This commit is contained in:
collin 2020-08-12 20:50:37 -07:00
parent cc3136193e
commit 8971821820
2 changed files with 7 additions and 3 deletions

View File

@ -55,12 +55,15 @@ pub fn verify_local_data_commitment(
)?;
// Construct record commitment merkle path
let mut local_data_merkle_path = CommitmentMerklePath::<LocalDataCommitment, LocalDataCRH>::read(&path[..])?;
local_data_merkle_path.parameters = Some(system_parameters.local_data_crh.clone());
let local_data_merkle_path = CommitmentMerklePath::<LocalDataCommitment, LocalDataCRH>::read(&path[..])?;
// Check record commitment merkle path is valid for the given local data commitment root
let local_data_commitment_root = <LocalDataCRH as CRH>::Output::read(&root[..])?;
let result = local_data_merkle_path.verify(&local_data_commitment_root, &local_data_commitment_leaf)?;
let result = local_data_merkle_path.verify(
&system_parameters.local_data_crh,
&local_data_commitment_root,
&local_data_commitment_leaf,
)?;
Ok(result)
}

View File

@ -133,6 +133,7 @@ fn test_generate_values_from_dpc() {
&mut rng,
)
.unwrap();
let local_data = context.into_local_data();
let leaf_index = 0;
let record = &local_data.old_records[leaf_index];