pub trait InclusionProvable {
type ProofNodeType;
type TreeStruct;
// Required methods
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.
Required Associated Types§
Sourcetype ProofNodeType
type ProofNodeType
The data type of a node with necessary information in Merkle proofs.
Sourcetype TreeStruct
type TreeStruct
The data type of the Merkle tree.
Required Methods§
Sourcefn 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.
Sourcefn 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.