Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
873a72ff98
commit
69d444c439
|
@ -502,7 +502,7 @@ impl<H: Hashable, const DEPTH: u8> MerklePath<H, DEPTH> {
|
|||
.enumerate()
|
||||
.fold(leaf, |root, (i, h)| {
|
||||
let level = Level(i as u8);
|
||||
if self.position.0 >> i & 0x1 == 0 {
|
||||
if (self.position.0 >> i) & 0x1 == 0 {
|
||||
H::combine(level, &root, h)
|
||||
} else {
|
||||
H::combine(level, h, &root)
|
||||
|
|
|
@ -18,6 +18,7 @@ use crate::{
|
|||
/// use incrementalmerkletree::{
|
||||
/// frontier::{CommitmentTree, testing::TestNode},
|
||||
/// witness::IncrementalWitness,
|
||||
/// Position
|
||||
/// };
|
||||
///
|
||||
/// let mut tree = CommitmentTree::<TestNode, 8>::empty();
|
||||
|
@ -25,7 +26,7 @@ use crate::{
|
|||
/// tree.append(TestNode(0));
|
||||
/// tree.append(TestNode(1));
|
||||
/// let mut witness = IncrementalWitness::from_tree(tree.clone());
|
||||
/// assert_eq!(witness.position(), 1);
|
||||
/// assert_eq!(witness.position(), Position::from(1));
|
||||
/// assert_eq!(tree.root(), witness.root());
|
||||
///
|
||||
/// let next = TestNode(2);
|
||||
|
|
Loading…
Reference in New Issue