Struct snarkvm_algorithms::merkle_tree::merkle_path::MerklePath
source · [−]pub struct MerklePath<P: MerkleParameters> {
pub parameters: Arc<P>,
pub path: Vec<MerkleTreeDigest<P>>,
pub leaf_index: u64,
}
Expand description
Stores the hashes of a particular path (in order) from leaf to root.
Our path is_left_child()
if the boolean in path
is true.
Fields
parameters: Arc<P>
path: Vec<MerkleTreeDigest<P>>
leaf_index: u64
Implementations
sourceimpl<P: MerkleParameters> MerklePath<P>
impl<P: MerkleParameters> MerklePath<P>
pub fn verify<L: ToBytes>(
&self,
root_hash: &MerkleTreeDigest<P>,
leaf: &L
) -> Result<bool, MerkleError>
sourcepub fn position_list(&self) -> impl Iterator<Item = bool> + '_
pub fn position_list(&self) -> impl Iterator<Item = bool> + '_
The position of on_path node in leaf_and_sibling_hash
and non_leaf_and_sibling_hash_path
.
position[i]
is 0 (false) iff i
th on-path node from top to bottom is on the left.
This function simply converts self.leaf_index
to boolean array in big endian form.
Trait Implementations
sourceimpl<P: Clone + MerkleParameters> Clone for MerklePath<P>
impl<P: Clone + MerkleParameters> Clone for MerklePath<P>
sourcefn clone(&self) -> MerklePath<P>
fn clone(&self) -> MerklePath<P>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<P: Debug + MerkleParameters> Debug for MerklePath<P>
impl<P: Debug + MerkleParameters> Debug for MerklePath<P>
sourceimpl<P: MerkleParameters> Default for MerklePath<P>
impl<P: MerkleParameters> Default for MerklePath<P>
sourceimpl<P: MerkleParameters> FromBytes for MerklePath<P>
impl<P: MerkleParameters> FromBytes for MerklePath<P>
Auto Trait Implementations
impl<P> RefUnwindSafe for MerklePath<P> where
P: RefUnwindSafe,
<<P as MerkleParameters>::H as CRH>::Output: RefUnwindSafe,
impl<P> Send for MerklePath<P>
impl<P> Sync for MerklePath<P>
impl<P> Unpin for MerklePath<P> where
<<P as MerkleParameters>::H as CRH>::Output: Unpin,
impl<P> UnwindSafe for MerklePath<P> where
P: RefUnwindSafe,
<<P as MerkleParameters>::H as CRH>::Output: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more