ckb_merkle_mountain_range

Struct MMR

Source
pub struct MMR<T, M, S> { /* private fields */ }

Implementations§

Source§

impl<T, M, S> MMR<T, M, S>

Source

pub fn new(mmr_size: u64, store: S) -> Self

Source

pub fn mmr_size(&self) -> u64

Source

pub fn is_empty(&self) -> bool

Source

pub fn batch(&self) -> &MMRBatch<T, S>

Source

pub fn store(&self) -> &S

Source§

impl<T: Clone + PartialEq, M: Merge<Item = T>, S: MMRStoreReadOps<T>> MMR<T, M, S>

Source

pub fn push(&mut self, elem: T) -> Result<u64>

Source

pub fn get_root(&self) -> Result<T>

get_root

Source

pub fn gen_proof(&self, pos_list: Vec<u64>) -> Result<MerkleProof<T, M>>

Generate merkle proof for positions

  1. sort positions
  2. push merkle proof to proof by peak from left to right
  3. push bagged right hand side root
Source§

impl<T, M, S: MMRStoreWriteOps<T>> MMR<T, M, S>

Source

pub fn commit(&mut self) -> Result<()>

Auto Trait Implementations§

§

impl<T, M, S> Freeze for MMR<T, M, S>
where S: Freeze,

§

impl<T, M, S> RefUnwindSafe for MMR<T, M, S>

§

impl<T, M, S> Send for MMR<T, M, S>
where S: Send, M: Send, T: Send,

§

impl<T, M, S> Sync for MMR<T, M, S>
where S: Sync, M: Sync, T: Sync,

§

impl<T, M, S> Unpin for MMR<T, M, S>
where S: Unpin, M: Unpin, T: Unpin,

§

impl<T, M, S> UnwindSafe for MMR<T, M, S>
where S: UnwindSafe, M: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.