pub struct SegmentProof { /* private fields */ }
Expand description
Merkle proof of a segment
Implementations§
source§impl SegmentProof
impl SegmentProof
sourcepub fn reconstruct_root(
&self,
last_pos: u64,
segment_first_pos0: u64,
segment_last_pos0: u64,
segment_root: Hash,
segment_unpruned_pos: u64
) -> Result<Hash, SegmentError>
pub fn reconstruct_root( &self, last_pos: u64, segment_first_pos0: u64, segment_last_pos0: u64, segment_root: Hash, segment_unpruned_pos: u64 ) -> Result<Hash, SegmentError>
Reconstruct PMMR root using this proof
sourcepub fn validate(
&self,
last_pos: u64,
mmr_root: Hash,
segment_first_pos: u64,
segment_last_pos: u64,
segment_root: Hash,
segment_unpruned_pos: u64
) -> Result<(), SegmentError>
pub fn validate( &self, last_pos: u64, mmr_root: Hash, segment_first_pos: u64, segment_last_pos: u64, segment_root: Hash, segment_unpruned_pos: u64 ) -> Result<(), SegmentError>
Check validity of the proof by equating the reconstructed root with the actual root
sourcepub fn validate_with(
&self,
last_pos: u64,
mmr_root: Hash,
segment_first_pos: u64,
segment_last_pos: u64,
segment_root: Hash,
segment_unpruned_pos: u64,
hash_last_pos: u64,
other_root: Hash,
other_is_left: bool
) -> Result<(), SegmentError>
pub fn validate_with( &self, last_pos: u64, mmr_root: Hash, segment_first_pos: u64, segment_last_pos: u64, segment_root: Hash, segment_unpruned_pos: u64, hash_last_pos: u64, other_root: Hash, other_is_left: bool ) -> Result<(), SegmentError>
Check validity of the proof by equating the reconstructed root with the actual root
This function assumes a final hashing step together with other_root
Trait Implementations§
source§impl Clone for SegmentProof
impl Clone for SegmentProof
source§fn clone(&self) -> SegmentProof
fn clone(&self) -> SegmentProof
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 SegmentProof
impl Debug for SegmentProof
source§impl PartialEq for SegmentProof
impl PartialEq for SegmentProof
source§fn eq(&self, other: &SegmentProof) -> bool
fn eq(&self, other: &SegmentProof) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Readable for SegmentProof
impl Readable for SegmentProof
source§impl Writeable for SegmentProof
impl Writeable for SegmentProof
impl Eq for SegmentProof
impl StructuralPartialEq for SegmentProof
Auto Trait Implementations§
impl Freeze for SegmentProof
impl RefUnwindSafe for SegmentProof
impl Send for SegmentProof
impl Sync for SegmentProof
impl Unpin for SegmentProof
impl UnwindSafe for SegmentProof
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.