Trait smtree::traits::InclusionProvable [−][src]
pub trait InclusionProvable {
type ProofNodeType;
type TreeStruct;
fn generate_inclusion_proof(
tree: &Self::TreeStruct,
list: &[TreeIndex]
) -> Option<Self>
where
Self: Sized;
fn verify_inclusion_proof(
&self,
leaves: &[Self::ProofNodeType],
root: &Self::ProofNodeType
) -> bool;
}
Expand description
Trait for generating and verifying inclusion proofs.
Associated Types
type ProofNodeType
type ProofNodeType
The data type of a node with necessary information in Merkle proofs.
type TreeStruct
type TreeStruct
The data type of the Merkle tree.
Required methods
fn generate_inclusion_proof(
tree: &Self::TreeStruct,
list: &[TreeIndex]
) -> Option<Self> where
Self: Sized,
fn generate_inclusion_proof(
tree: &Self::TreeStruct,
list: &[TreeIndex]
) -> Option<Self> where
Self: Sized,
Generate an inclusion proof for the input list of indexes.
fn verify_inclusion_proof(
&self,
leaves: &[Self::ProofNodeType],
root: &Self::ProofNodeType
) -> bool
fn verify_inclusion_proof(
&self,
leaves: &[Self::ProofNodeType],
root: &Self::ProofNodeType
) -> bool
Verify the inclusion proof according to the leave nodes and the root.