[][src]Enum exonum_merkledb::ListProof

pub enum ListProof<V> {
    Full(Box<ListProof<V>>, Box<ListProof<V>>),
    Left(Box<ListProof<V>>, Option<Hash>),
    Right(HashBox<ListProof<V>>),
    Leaf(V),
    Absent(ProofOfAbsence),
}

An enum that represents a proof of existence for a proof list elements.

Variants

Full(Box<ListProof<V>>, Box<ListProof<V>>)

A branch of proof in which both children contain requested elements.

Left(Box<ListProof<V>>, Option<Hash>)

A branch of proof in which only the left child contains requested elements.

Right(HashBox<ListProof<V>>)

A branch of proof in which only the right child contains requested elements.

Leaf(V)

A leaf of the proof with the requested element.

Absent(ProofOfAbsence)

Proof of absence of an element with the specified index.

Methods

impl<V> ListProof<V> where
    V: BinaryValue
[src]

pub fn validate(
    &self,
    expected_list_hash: Hash,
    len: u64
) -> Result<Vec<(u64, &V)>, ListProofError>
[src]

Verifies the correctness of the proof by the trusted list hash and the number of elements in the tree.

To validate the proof one needs to provide expected_list_hash calculated as follows:

h = sha-256( HashTag::List || len as u64 || merkle_root )

and length of the ProofListIndex.

If the proof is valid, a vector with indices and references to elements is returned. Otherwise, Err is returned.

If the proof is the proof of absence, then empty vector will be returned.

Trait Implementations

impl<V: Clone> Clone for ListProof<V>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<V: PartialEq> PartialEq<ListProof<V>> for ListProof<V>[src]

impl<V: Eq> Eq for ListProof<V>[src]

impl<V: Debug> Debug for ListProof<V>[src]

impl<V: Serialize> Serialize for ListProof<V>[src]

impl<'a, V> Deserialize<'a> for ListProof<V> where
    V: Deserialize<'de>, 
[src]

Auto Trait Implementations

impl<V> Sync for ListProof<V> where
    V: Sync

impl<V> Send for ListProof<V> where
    V: Send

impl<V> Unpin for ListProof<V> where
    V: Unpin

impl<V> RefUnwindSafe for ListProof<V> where
    V: RefUnwindSafe

impl<V> UnwindSafe for ListProof<V> where
    V: UnwindSafe

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[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> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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

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

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