Struct merkle::MerkleTree
[−]
[src]
pub struct MerkleTree<D, T> {
pub digest: D,
pub tree: Tree<T>,
pub height: usize,
pub count: usize,
}A Merkle tree is a binary tree, with values of type T at the leafs,
and where every node holds the hash of the concatenation of the hashes of
its children nodes.
Fields
digest: D
The hashing function used by this Merkle tree
tree: Tree<T>
The inner binary tree
height: usize
The height of the tree
count: usize
The number of leaf nodes in the tree
Methods
impl<D, T> MerkleTree<D, T> where D: Digest + Clone, T: Into<Vec<u8>> + Clone[src]
fn from_vec(digest: D, values: Vec<T>) -> Self
Constructs a Merkle Tree from a vector of data blocks
fn root_hash(&self) -> &Vec<u8>
Returns the tree's root hash
fn gen_proof(&self, value: &T) -> Option<Proof<D, T>>
Generate an inclusion proof for the given value.
None is returned if the given value is not found in the tree.