Skip to content

Commit cf05843

Browse files
committed
fix: proof Node docstring
1 parent 965215e commit cf05843

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

mrkle/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,11 @@ impl<T, D: Digest, Ix: IndexType> MrkleNode<T, D, Ix> {
333333
None
334334
}
335335
}
336+
337+
/// Return Reference to [`MrkleNode`] hash.
338+
pub fn hash(&self) -> &GenericArray<D> {
339+
&self.hash
340+
}
336341
}
337342

338343
/// Represents the contents of a node in a Merkle tree.

mrkle/src/proof.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ use crate::{
4646
/// // Obtain mut referecne to leaf \w in proof.
4747
/// let leaf = proof.get_leaf_mut(NodeIndex::new(0)).unwrap();
4848
///
49-
/// let hash = tree.get(NodeIndex::new(4)).unwrap().hash.clone();
49+
/// let hash = tree.get(NodeIndex::new(4)).unwrap().hash().clone();
5050
/// leaf.update(Some(hash));
5151
///
52-
/// assert!(proof.try_validate_basic()?);
52+
/// assert!(proof.try_validate_basic().unwrap());
5353
/// ```
5454
///
5555
/// # Security Considerations
@@ -97,7 +97,7 @@ impl<D: Digest, Ix: IndexType> MrkleProofNode<D, Ix> {
9797
}
9898

9999
/// Update internal hash with new [`GenericArray`].
100-
pub(crate) fn update(&mut self, hash: Option<GenericArray<D>>) {
100+
pub fn update(&mut self, hash: Option<GenericArray<D>>) {
101101
self.hash = hash;
102102
}
103103

0 commit comments

Comments
 (0)