Struct snarkvm_dpc::ledger::ledger_tree::LedgerTree
source · [−]pub struct LedgerTree<N: Network> { /* private fields */ }
Expand description
A ledger tree contains all block hashes on the ledger.
Trait Implementations
sourceimpl<N: Network> Clone for LedgerTree<N> where
N: Network,
impl<N: Network> Clone for LedgerTree<N> where
N: Network,
sourceimpl<N: Network> Debug for LedgerTree<N> where
N: Network,
impl<N: Network> Debug for LedgerTree<N> where
N: Network,
sourceimpl<N: Network> Default for LedgerTree<N>
impl<N: Network> Default for LedgerTree<N>
sourceimpl<N: Network> LedgerTreeScheme<N> for LedgerTree<N>
impl<N: Network> LedgerTreeScheme<N> for LedgerTree<N>
sourcefn add(&mut self, block_hash: &N::BlockHash) -> Result<u32>
fn add(&mut self, block_hash: &N::BlockHash) -> Result<u32>
TODO (howardwu): Add safety checks for u32 (max 2^32). Adds the given block hash to the tree, returning its index in the tree.
sourcefn add_all(&mut self, block_hashes: &[N::BlockHash]) -> Result<(u32, u32)>
fn add_all(&mut self, block_hashes: &[N::BlockHash]) -> Result<(u32, u32)>
TODO (howardwu): Add safety checks for u32 (max 2^32). Adds all given block hashes to the tree, returning the start and ending index in the tree.
sourcefn contains_block_hash(&self, block_hash: &N::BlockHash) -> bool
fn contains_block_hash(&self, block_hash: &N::BlockHash) -> bool
Returns true
if the given block hash exists.
sourcefn get_block_hash_index(&self, block_hash: &N::BlockHash) -> Option<&u32>
fn get_block_hash_index(&self, block_hash: &N::BlockHash) -> Option<&u32>
Returns the index for the given block hash, if it exists.
sourcefn root(&self) -> N::LedgerRoot
fn root(&self) -> N::LedgerRoot
Returns the ledger root.
sourcefn to_ledger_inclusion_proof(
&self,
block_hash: &N::BlockHash
) -> Result<MerklePath<N::LedgerRootParameters>>
fn to_ledger_inclusion_proof(
&self,
block_hash: &N::BlockHash
) -> Result<MerklePath<N::LedgerRootParameters>>
Returns the Merkle path for a given block hash.
Auto Trait Implementations
impl<N> RefUnwindSafe for LedgerTree<N> where
<N as Network>::BlockHash: RefUnwindSafe,
<N as Network>::InnerScalarField: RefUnwindSafe,
<N as Network>::LedgerRootParameters: RefUnwindSafe,
impl<N> Send for LedgerTree<N>
impl<N> Sync for LedgerTree<N>
impl<N> Unpin for LedgerTree<N> where
<N as Network>::BlockHash: Unpin,
impl<N> UnwindSafe for LedgerTree<N> where
<N as Network>::BlockHash: UnwindSafe,
<N as Network>::InnerScalarField: RefUnwindSafe,
<N as Network>::LedgerRootParameters: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more