Struct grin_core::core::merkle_proof::MerkleProof
source · pub struct MerkleProof {
pub mmr_size: u64,
pub path: Vec<Hash>,
}
Expand description
A Merkle proof that proves a particular element exists in the MMR.
Fields§
§mmr_size: u64
The size of the MMR at the time the proof was created.
path: Vec<Hash>
The sibling path from the leaf up to the final sibling hashing to the root.
Implementations§
source§impl MerkleProof
impl MerkleProof
sourcepub fn empty() -> MerkleProof
pub fn empty() -> MerkleProof
The “empty” Merkle proof.
sourcepub fn to_hex(&self) -> String
pub fn to_hex(&self) -> String
Serialize the Merkle proof as a hex string (for api json endpoints)
sourcepub fn from_hex(hex: &str) -> Result<MerkleProof, String>
pub fn from_hex(hex: &str) -> Result<MerkleProof, String>
Convert hex string representation back to a Merkle proof instance
sourcepub fn verify(
&self,
root: Hash,
element: &dyn PMMRIndexHashable,
node_pos: u64
) -> Result<(), MerkleProofError>
pub fn verify( &self, root: Hash, element: &dyn PMMRIndexHashable, node_pos: u64 ) -> Result<(), MerkleProofError>
Verifies the Merkle proof against the provided root hash, element and position in the MMR.
Trait Implementations§
source§impl Clone for MerkleProof
impl Clone for MerkleProof
source§fn clone(&self) -> MerkleProof
fn clone(&self) -> MerkleProof
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for MerkleProof
impl Debug for MerkleProof
source§impl Default for MerkleProof
impl Default for MerkleProof
source§fn default() -> MerkleProof
fn default() -> MerkleProof
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for MerkleProof
impl<'de> Deserialize<'de> for MerkleProof
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for MerkleProof
impl Ord for MerkleProof
source§fn cmp(&self, other: &MerkleProof) -> Ordering
fn cmp(&self, other: &MerkleProof) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for MerkleProof
impl PartialEq for MerkleProof
source§fn eq(&self, other: &MerkleProof) -> bool
fn eq(&self, other: &MerkleProof) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for MerkleProof
impl PartialOrd for MerkleProof
source§fn partial_cmp(&self, other: &MerkleProof) -> Option<Ordering>
fn partial_cmp(&self, other: &MerkleProof) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Readable for MerkleProof
impl Readable for MerkleProof
source§impl Serialize for MerkleProof
impl Serialize for MerkleProof
source§impl Writeable for MerkleProof
impl Writeable for MerkleProof
impl Eq for MerkleProof
impl StructuralPartialEq for MerkleProof
Auto Trait Implementations§
impl Freeze for MerkleProof
impl RefUnwindSafe for MerkleProof
impl Send for MerkleProof
impl Sync for MerkleProof
impl Unpin for MerkleProof
impl UnwindSafe for MerkleProof
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.