Skip to content

Commit

Permalink
Allow only to update latest tree.
Browse files Browse the repository at this point in the history
  • Loading branch information
piohei committed Oct 24, 2024
1 parent 1d18ba4 commit fee5948
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/identity_tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,6 @@ impl<V: Version<TreeVersion = lazy_merkle_tree::Derived>> TreeVersion<V> {
/// all versions. This being a trait allows us to hide some of the
/// implementation details.
pub trait TreeVersionOps {
fn update(&self, leaf_index: usize, element: Hash);

/// Returns the current tree root.
fn get_root(&self) -> Hash;
/// Returns the next free leaf.
Expand All @@ -417,10 +415,6 @@ impl<V: Version> TreeVersionOps for TreeVersion<V>
where
TreeVersionData<V::TreeVersion>: BasicTreeOps,
{
fn update(&self, leaf_index: usize, element: Hash) {
self.get_data().update(leaf_index, element);
}

fn get_root(&self) -> Hash {
self.get_data().get_root()
}
Expand Down Expand Up @@ -456,6 +450,11 @@ impl<V: Version> TreeVersion<V> {
}

impl TreeVersion<Latest> {
/// Updates tree by inserting element at leaf index.
pub fn update(&self, leaf_index: usize, element: Hash) {
self.get_data().update(leaf_index, element);
}

/// Appends many identities to the tree, returns a list with the root, proof
/// of inclusion and leaf index
#[must_use]
Expand Down

0 comments on commit fee5948

Please sign in to comment.