From 8abeb3f8457de5c9c4bdbe47c775b92e404ae869 Mon Sep 17 00:00:00 2001 From: HaoranYi Date: Fri, 8 Nov 2024 23:10:22 +0000 Subject: [PATCH] comments --- accounts-db/src/accounts_hash.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/accounts-db/src/accounts_hash.rs b/accounts-db/src/accounts_hash.rs index c16e5a17f0cae2..eabc7d8140c9e8 100644 --- a/accounts-db/src/accounts_hash.rs +++ b/accounts-db/src/accounts_hash.rs @@ -536,8 +536,12 @@ impl<'a> AccountsHasher<'a> { (num_hashes_per_chunk, levels_hashed, three_level) } - // This function is designed to allow hashes to be located in multiple, perhaps multiply deep vecs. - // The caller provides a function to return a vec of hash from the source data. + // This function is called at the top lover level to compute the merkle. It + // takes a closure that returns an owned vec of hash data at the leaf level + // of the merkle tree. The input data for this bottom level are read from a + // file. For non-leaves nodes, where the input data is already in memory, we + // will use `compute_merkle_root_from_slices`, which is a version that takes + // a borrowed slice of hash data instead. fn compute_merkle_root_from_start( total_hashes: usize, fanout: usize, @@ -568,7 +572,6 @@ impl<'a> AccountsHasher<'a> { // initial fetch - could return entire slice let data_bytes = get_hash_slice_starting_at_index(0); let data: &[T] = bytemuck::cast_slice(&data_bytes); - let data_len = data.len(); let result: Vec<_> = (0..chunks)