[][src]Struct grin_chain::txhashset::TxHashSet

pub struct TxHashSet { /* fields omitted */ }

An easy to manipulate structure holding the 3 MMRs necessary to validate blocks and capturing the output set, associated rangeproofs and the kernels. Also handles the index of Commitments to positions in the output and rangeproof MMRs.

Note that the index is never authoritative, only the trees are guaranteed to indicate whether an output is spent or not. The index may have commitments that have already been spent, even with pruning enabled.

Methods

impl TxHashSet[src]

pub fn open(
    root_dir: String,
    commit_index: Arc<ChainStore>,
    header: Option<&BlockHeader>
) -> Result<TxHashSet, Error>
[src]

Open an existing or new set of backends for the TxHashSet

pub fn release_backend_files(&mut self)[src]

Close all backend file handles

pub fn is_unspent(
    &self,
    output_id: &OutputIdentifier
) -> Result<CommitPos, Error>
[src]

Check if an output is unspent. We look in the index to find the output MMR pos. Then we check the entry in the output MMR and confirm the hash matches.

pub fn last_n_output(&self, distance: u64) -> Vec<(Hash, OutputIdentifier)>[src]

returns the last N nodes inserted into the tree (i.e. the 'bottom' nodes at level 0 TODO: These need to return the actual data from the flat-files instead of hashes now

pub fn last_n_rangeproof(&self, distance: u64) -> Vec<(Hash, RangeProof)>[src]

as above, for range proofs

pub fn last_n_kernel(&self, distance: u64) -> Vec<(Hash, TxKernel)>[src]

as above, for kernels

pub fn get_block_header(&self, hash: &Hash) -> Result<BlockHeader, Error>[src]

Convenience function to query the db for a header by its hash.

pub fn outputs_by_pmmr_index(
    &self,
    start_index: u64,
    max_count: u64,
    max_index: Option<u64>
) -> (u64, Vec<OutputIdentifier>)
[src]

returns outputs from the given pmmr index up to the specified limit. Also returns the last index actually populated max index is the last PMMR index to consider, not leaf index

pub fn highest_output_insertion_index(&self) -> u64[src]

highest output insertion index available

pub fn rangeproofs_by_pmmr_index(
    &self,
    start_index: u64,
    max_count: u64,
    max_index: Option<u64>
) -> (u64, Vec<RangeProof>)
[src]

As above, for rangeproofs

pub fn find_kernel(
    &self,
    excess: &Commitment,
    min_index: Option<u64>,
    max_index: Option<u64>
) -> Option<(TxKernel, u64)>
[src]

Find a kernel with a given excess. Work backwards from max_index to min_index

pub fn roots(&self) -> TxHashSetRoots[src]

Get MMR roots.

pub fn get_output_pos(&self, commit: &Commitment) -> Result<u64, Error>[src]

Return Commit's MMR position

pub fn merkle_proof(&mut self, commit: Commitment) -> Result<MerkleProof, Error>[src]

build a new merkle proof for the given position.

pub fn compact(
    &mut self,
    horizon_header: &BlockHeader,
    batch: &Batch
) -> Result<(), Error>
[src]

Compact the MMR data files and flush the rm logs

pub fn init_output_pos_index(
    &self,
    header_pmmr: &PMMRHandle<BlockHeader>,
    batch: &Batch
) -> Result<(), Error>
[src]

(Re)build the output_pos index to be consistent with the current UTXO set. Remove any "stale" index entries that do not correspond to outputs in the UTXO set. Add any missing index entries based on UTXO set.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SafeBorrow<T> for T where
    T: ?Sized

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> UnsafeAny for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,