fn compute_root_hash_naive(leaves: &[HashValue]) -> HashValue {
    let position_to_hash = compute_hashes_for_all_positions(leaves);
    if position_to_hash.is_empty() {
        return *ACCUMULATOR_PLACEHOLDER_HASH;
    }

    let rightmost_leaf_index = leaves.len() as u64 - 1;
    *position_to_hash
        .get(&NodeIndex::root_from_leaf_index(rightmost_leaf_index))
        .expect("Root position should exist in the map.")
}
// Computes the root hash of an accumulator with given leaves.
Computes the root hash of an accumulator with given leaves.
Computes the root hash of an accumulator with given leaves .
fn compute_root_hash_naive(leaves: &[HashValue]) -> HashValue {
    let position_to_hash = compute_hashes_for_all_positions(leaves);
    if position_to_hash.is_empty() {
        return *ACCUMULATOR_PLACEHOLDER_HASH;
    }
    let rightmost_leaf_index = leaves.len() as u64 - 1;
    *position_to_hash
        .get(&NodeIndex::root_from_leaf_index(rightmost_leaf_index))
        .expect("Root position should exist in the map.")
}
fn compute_root_hash_naive ( leaves : & [ HashValue ] ) -> HashValue { let position_to_hash = compute_hashes_for_all_positions ( leaves ) ; if position_to_hash . is_empty ( ) { return * ACCUMULATOR_PLACEHOLDER_HASH ; } let rightmost_leaf_index = leaves . len ( ) as u64 - 1 ; * position_to_hash . get ( & NodeIndex :: root_from_leaf_index ( rightmost_leaf_index ) ) . expect ( " " ) }
Computes the root hash of an accumulator with given leaves.
Computes the root hash of an accumulator with given leaves .
leaves
&[HashValue]
leaves
&[HashValue]