Struct ckb_merkle_mountain_range::MMR
source · pub struct MMR<T, M, S: MMRStore<T>> { /* private fields */ }
Implementations§
source§impl<'a, T: Clone + PartialEq + Debug, M: Merge<Item = T>, S: MMRStore<T>> MMR<T, M, S>
impl<'a, T: Clone + PartialEq + Debug, M: Merge<Item = T>, S: MMRStore<T>> MMR<T, M, S>
pub fn new(mmr_size: u64, store: S) -> Self
pub fn mmr_size(&self) -> u64
pub fn is_empty(&self) -> bool
pub fn push(&mut self, elem: T) -> Result<u64>
sourcepub fn gen_proof(&self, pos_list: Vec<u64>) -> Result<MerkleProof<T, M>>
pub fn gen_proof(&self, pos_list: Vec<u64>) -> Result<MerkleProof<T, M>>
Generate merkle proof for positions
- sort positions
- push merkle proof to proof by peak from left to right
- push bagged right hand side root