[−][src]Struct tari_mmr::MerkleProof
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<D, B>(
mmr: &MerkleMountainRange<D, B>,
leaf_index: usize
) -> Result<MerkleProof, MerkleProofError> where
D: Digest,
B: ArrayLike<Value = Hash>,
[src]
mmr: &MerkleMountainRange<D, B>,
leaf_index: usize
) -> Result<MerkleProof, MerkleProofError> where
D: Digest,
B: ArrayLike<Value = Hash>,
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<D, B>(
mmr: &MerkleMountainRange<D, B>,
pos: usize
) -> Result<MerkleProof, MerkleProofError> where
D: Digest,
B: ArrayLike<Value = Hash>,
[src]
mmr: &MerkleMountainRange<D, B>,
pos: usize
) -> Result<MerkleProof, MerkleProofError> where
D: Digest,
B: ArrayLike<Value = Hash>,
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<D: Digest>(
&self,
root: &HashSlice,
hash: &HashSlice,
leaf_index: usize
) -> Result<(), MerkleProofError>
[src]
&self,
root: &HashSlice,
hash: &HashSlice,
leaf_index: usize
) -> Result<(), MerkleProofError>
pub fn verify<D: Digest>(
&self,
root: &HashSlice,
hash: &HashSlice,
pos: usize
) -> Result<(), MerkleProofError>
[src]
&self,
root: &HashSlice,
hash: &HashSlice,
pos: usize
) -> Result<(), MerkleProofError>
Verifies the Merkle proof against the provided root hash, element and position in the MMR.
Trait Implementations
impl Clone for MerkleProof
[src]
fn clone(&self) -> MerkleProof
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for MerkleProof
[src]
impl Default for MerkleProof
[src]
fn default() -> MerkleProof
[src]
impl<'de> Deserialize<'de> for MerkleProof
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for MerkleProof
[src]
impl Eq for MerkleProof
[src]
impl Ord for MerkleProof
[src]
fn cmp(&self, other: &MerkleProof) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<MerkleProof> for MerkleProof
[src]
fn eq(&self, other: &MerkleProof) -> bool
[src]
fn ne(&self, other: &MerkleProof) -> bool
[src]
impl PartialOrd<MerkleProof> for MerkleProof
[src]
fn partial_cmp(&self, other: &MerkleProof) -> Option<Ordering>
[src]
fn lt(&self, other: &MerkleProof) -> bool
[src]
fn le(&self, other: &MerkleProof) -> bool
[src]
fn gt(&self, other: &MerkleProof) -> bool
[src]
fn ge(&self, other: &MerkleProof) -> bool
[src]
impl Serialize for MerkleProof
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for MerkleProof
[src]
impl StructuralPartialEq for MerkleProof
[src]
Auto Trait Implementations
impl RefUnwindSafe for MerkleProof
impl Send for MerkleProof
impl Sync for MerkleProof
impl Unpin for MerkleProof
impl UnwindSafe for MerkleProof
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Clear for T where
T: InitializableFromZeroed + ?Sized,
T: InitializableFromZeroed + ?Sized,
fn clear(&mut self)
impl<'a, T> DefaultFeatures<'a> for T where
T: 'a + Clone + Send + Sync,
T: 'a + Clone + Send + Sync,
fn clone_boxed(&self) -> Box<dyn DefaultFeatures<'a> + 'a>
fn self_address_mut(&mut self) -> *mut ()
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> InitializableFromZeroed for T where
T: Default,
T: Default,
unsafe fn initialize(place: *mut T)
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> MessageFormat for T where
T: DeserializeOwned + Serialize,
[src]
T: DeserializeOwned + Serialize,
fn to_binary(&self) -> Result<Vec<u8>, MessageFormatError>
[src]
fn to_json(&self) -> Result<String, MessageFormatError>
[src]
fn to_base64(&self) -> Result<String, MessageFormatError>
[src]
fn from_binary(msg: &[u8]) -> Result<T, MessageFormatError>
[src]
fn from_json(msg: &str) -> Result<T, MessageFormatError>
[src]
fn from_base64(msg: &str) -> Result<T, MessageFormatError>
[src]
impl<'a, T> NonSyncFeatures<'a> for T where
T: 'a + Clone,
T: 'a + Clone,
fn clone_boxed(&self) -> Box<dyn NonSyncFeatures<'a> + 'a>
fn self_address_mut(&mut self) -> *mut ()
impl<T> SafeBorrow<T> for T where
T: ?Sized,
T: ?Sized,
fn borrow_replacement(ptr: &T) -> &T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,