[][src]Struct sparse_merkle_tree::merkle_proof::MerkleProof

pub struct MerkleProof { /* fields omitted */ }

Implementations

impl MerkleProof[src]

pub fn new(leaves_path: Vec<Vec<u8>>, proof: Vec<(H256, u8)>) -> Self[src]

Create MerkleProof leaves_path: contains height of non-zero siblings proof: contains merkle path for each leaves it's height

pub fn take(self) -> (Vec<Vec<u8>>, Vec<(H256, u8)>)[src]

Destruct the structure, useful for serialization

pub fn leaves_count(&self) -> usize[src]

number of leaves required by this merkle proof

pub fn leaves_path(&self) -> &Vec<Vec<u8>>[src]

return the inner leaves_path vector

pub fn proof(&self) -> &Vec<(H256, u8)>[src]

return proof merkle path

pub fn compile(self, leaves: Vec<(H256, H256)>) -> Result<CompiledMerkleProof>[src]

convert merkle proof into CompiledMerkleProof

pub fn compute_root<H: Hasher + Default>(
    self,
    leaves: Vec<(H256, H256)>
) -> Result<H256>
[src]

Compute root from proof leaves: a vector of (key, value)

return EmptyProof error when proof is empty return CorruptedProof error when proof is invalid

pub fn verify<H: Hasher + Default>(
    self,
    root: &H256,
    leaves: Vec<(H256, H256)>
) -> Result<bool>
[src]

Verify merkle proof see compute_root_from_proof

Trait Implementations

impl Clone for MerkleProof[src]

impl Debug for MerkleProof[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.