[][src]Struct geen::MerkleProof

pub struct MerkleProof { /* fields omitted */ }

A Merkle proof that proves a particular element at a particular position exists in an MMR.

Methods

impl MerkleProof[src]

pub fn for_leaf_node<B>(
    mmr: &MerkleMountainRange<B>,
    leaf_pos: usize
) -> Result<MerkleProof, GeneError> where
    B: Storage<Value = H256>, 
[src]

Build a Merkle Proof the given MMR at the given leaf position. This is usually the version you'll want to call, since you'll know the leaf index more often than the MMR index.

For the difference between leaf node and MMR node indices, see the [mod level] documentation.

See MerkleProof::for_node for more details on how the proof is constructed.

pub fn for_node<B>(
    mmr: &MerkleMountainRange<B>,
    pos: usize
) -> Result<MerkleProof, GeneError> where
    B: Storage<Value = H256>, 
[src]

Build a Merkle proof for the candidate node at the given MMR index. If you want to build a proof using the leaf position, call MerkleProof::for_leaf_node instead. The given node position must be a leaf node, otherwise a MerkleProofError::NonLeafNode error will be returned.

The proof for the MMR consists of two parts: a) A list of sibling node hashes starting from the candidate node and walking up the tree to the local root (i.e. the root of the binary tree that the candidate node lives in. b) A list of MMR peaks, excluding the local node hash. The final Merkle proof is constructed by hashing all the peaks together (this is slightly different to how other MMR implementations work).

pub fn verify_leaf(
    &self,
    root: &H256,
    hash: &H256,
    leaf_pos: usize
) -> Result<(), GeneError>
[src]

pub fn verify(
    &self,
    root: &H256,
    hash: &H256,
    pos: usize
) -> Result<(), GeneError>
[src]

Verifies the Merkle proof against the provided root hash, element and position in the MMR.

Trait Implementations

impl Clone for MerkleProof[src]

impl Default for MerkleProof[src]

impl Eq for MerkleProof[src]

impl Ord for MerkleProof[src]

impl PartialEq<MerkleProof> for MerkleProof[src]

impl PartialOrd<MerkleProof> for MerkleProof[src]

impl Display for MerkleProof[src]

impl Debug for MerkleProof[src]

impl StructuralPartialEq for MerkleProof[src]

impl StructuralEq for MerkleProof[src]

impl Writeable for MerkleProof[src]

impl Readable for MerkleProof[src]

impl<'de> Deserialize<'de> for MerkleProof[src]

impl Serialize for MerkleProof[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.

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

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

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

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> FromCast<T> for T

impl<T, U> Cast<U> for T where
    U: FromCast<T>, 

impl<T> FromBits<T> for T

impl<T, U> IntoBits<U> for T where
    U: FromBits<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,