Merge branch 'Rate-Limiting-Nullifier:main' into make-db-public

This commit is contained in:
Aaryamann Challani 2023-06-15 16:07:59 +05:30 committed by GitHub
commit 8b005bb44a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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