mirror of https://github.com/vacp2p/pmtree.git
Merge pull request #11 from Rate-Limiting-Nullifier/fix-add-public-get
fix: add public getters
This commit is contained in:
commit
a312a50bff
|
@ -344,6 +344,15 @@ where
|
|||
self.root() == expected_root
|
||||
}
|
||||
|
||||
// Returns the leaf by the key
|
||||
pub fn get(&self, key: usize) -> PmtreeResult<H::Fr> {
|
||||
if key >= self.capacity() {
|
||||
return Err(PmtreeErrorKind::TreeError(TreeErrorKind::IndexOutOfBounds));
|
||||
}
|
||||
|
||||
self.get_elem(Key(self.depth, key))
|
||||
}
|
||||
|
||||
/// Returns the root of the tree
|
||||
pub fn root(&self) -> H::Fr {
|
||||
self.root
|
||||
|
|
Loading…
Reference in New Issue