(&self, leaf: [u8; 32])
| 128 | } |
| 129 | |
| 130 | pub fn get_subroot(&self, leaf: [u8; 32]) -> [u8; 32] { |
| 131 | let mut current_hash = leaf; |
| 132 | for i in 0..self.inclusion_proof.len() { |
| 133 | let sibling = self.inclusion_proof[i]; |
| 134 | if self.internal_idx & (1 << i) == 0 { |
| 135 | current_hash = hash_pair(current_hash, sibling); |
| 136 | } else { |
| 137 | current_hash = hash_pair(sibling, current_hash); |
| 138 | } |
| 139 | } |
| 140 | current_hash |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | #[cfg(test)] |
no test coverage detected