Enum exonum::storage::MapProof
[−]
[src]
pub enum MapProof<V> { LeafRootInclusive(DBKey, V), LeafRootExclusive(DBKey, Hash), Empty, Branch(BranchProofNode<V>), }
An enum that represents a proof of existence or non-existence for a proof map key.
Variants
LeafRootInclusive(DBKey, V)
A boundary case with a single element tree and a matching key.
LeafRootExclusive(DBKey, Hash)
A boundary case with a single element tree and a non-matching key
Empty
A boundary case with empty tree.
Branch(BranchProofNode<V>)
A root branch of the tree.
Methods
impl<V: StorageValue> MapProof<V>
[src]
impl<V: Debug + StorageValue> MapProof<V>
[src]
fn validate<K: ProofMapKey>(
&self,
key: &K,
root_hash: Hash
) -> Result<Option<&V>, Error>
[src]
&self,
key: &K,
root_hash: Hash
) -> Result<Option<&V>, Error>
Verifies the correctness of the proof by the trusted root hash and the requested key.
If the proof is valid and the requested key exists, Ok(Some(&V))
is returned.
If the proof is valid and the requested key does not exists, Ok(None)
is returned.
If the proof is invalid, Err
is returned.
Trait Implementations
impl<V: Serialize> Serialize for MapProof<V>
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
[src]
S: Serializer,
Serialize this value into the given Serde serializer. Read more