Struct ckb_merkle_mountain_range::MMR
source · [−]pub struct MMR<T, M, S> { /* private fields */ }
Implementations
sourceimpl<T: Clone + PartialEq + Debug, M: Merge<Item = T>, S: MMRStore<T>> MMR<T, M, S>
impl<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
pub fn commit(self) -> Result<()>
Auto Trait Implementations
impl<T, M, S> RefUnwindSafe for MMR<T, M, S>where
M: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, M, S> Send for MMR<T, M, S>where
M: Send,
S: Send,
T: Send,
impl<T, M, S> Sync for MMR<T, M, S>where
M: Sync,
S: Sync,
T: Sync,
impl<T, M, S> Unpin for MMR<T, M, S>where
M: Unpin,
S: Unpin,
T: Unpin,
impl<T, M, S> UnwindSafe for MMR<T, M, S>where
M: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more