mithril_common::crypto_helper

Trait MKTreeLeafIndexer

source
pub trait MKTreeLeafIndexer {
    // Required methods
    fn set_leaf_position(
        &self,
        pos: MKTreeLeafPosition,
        leaf: Arc<MKTreeNode>,
    ) -> StdResult<()>;
    fn get_leaf_position(&self, leaf: &MKTreeNode) -> Option<MKTreeLeafPosition>;
    fn total_leaves(&self) -> usize;
    fn leaves(&self) -> Vec<MKTreeNode>;

    // Provided method
    fn contains_leaf(&self, leaf: &MKTreeNode) -> bool { ... }
}
Expand description

The Merkle tree leaves indexer trait

Required Methods§

source

fn set_leaf_position( &self, pos: MKTreeLeafPosition, leaf: Arc<MKTreeNode>, ) -> StdResult<()>

Get the position of the leaf in the Merkle tree

source

fn get_leaf_position(&self, leaf: &MKTreeNode) -> Option<MKTreeLeafPosition>

Get the position of the leaf in the Merkle tree

source

fn total_leaves(&self) -> usize

Number of leaves in the Merkle tree

source

fn leaves(&self) -> Vec<MKTreeNode>

List of leaves with their positions in the Merkle tree

Provided Methods§

source

fn contains_leaf(&self, leaf: &MKTreeNode) -> bool

Check if the Merkle tree contains the given leaf

Implementors§