[−][src]Struct grin_chain::txhashset::TxHashSet
An easy to manipulate structure holding the 3 sum trees necessary to validate blocks and capturing the Output set, the range proofs and the kernels. Also handles the index of Commitments to positions in the output and range proof pmmr trees.
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]
impl TxHashSet
pub fn open(
root_dir: String,
commit_index: Arc<ChainStore>,
header: Option<&BlockHeader>
) -> Result<TxHashSet, Error>
[src]
pub fn open(
root_dir: String,
commit_index: Arc<ChainStore>,
header: Option<&BlockHeader>
) -> Result<TxHashSet, Error>
Open an existing or new set of backends for the TxHashSet
pub fn is_unspent(
&self,
output_id: &OutputIdentifier
) -> Result<(Hash, u64), Error>
[src]
pub fn is_unspent(
&self,
output_id: &OutputIdentifier
) -> Result<(Hash, u64), Error>
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]
pub fn last_n_output(&self, distance: u64) -> Vec<(Hash, OutputIdentifier)>
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]
pub fn last_n_rangeproof(&self, distance: u64) -> Vec<(Hash, RangeProof)>
as above, for range proofs
pub fn last_n_kernel(&self, distance: u64) -> Vec<(Hash, TxKernelEntry)>
[src]
pub fn last_n_kernel(&self, distance: u64) -> Vec<(Hash, TxKernelEntry)>
as above, for kernels
pub fn get_header_by_height(&self, height: u64) -> Result<BlockHeader, Error>
[src]
pub fn get_header_by_height(&self, height: u64) -> Result<BlockHeader, Error>
Get the header at the specified height based on the current state of the txhashset. Derives the MMR pos from the height (insertion index) and retrieves the header hash. Looks the header up in the db by hash.
pub fn outputs_by_insertion_index(
&self,
start_index: u64,
max_count: u64
) -> (u64, Vec<OutputIdentifier>)
[src]
pub fn outputs_by_insertion_index(
&self,
start_index: u64,
max_count: u64
) -> (u64, Vec<OutputIdentifier>)
returns outputs from the given insertion (leaf) index up to the specified limit. Also returns the last index actually populated
pub fn highest_output_insertion_index(&self) -> u64
[src]
pub fn highest_output_insertion_index(&self) -> u64
highest output insertion index available
pub fn rangeproofs_by_insertion_index(
&self,
start_index: u64,
max_count: u64
) -> (u64, Vec<RangeProof>)
[src]
pub fn rangeproofs_by_insertion_index(
&self,
start_index: u64,
max_count: u64
) -> (u64, Vec<RangeProof>)
As above, for rangeproofs
pub fn roots(&self) -> TxHashSetRoots
[src]
pub fn roots(&self) -> TxHashSetRoots
Get MMR roots.
pub fn merkle_proof(
&mut self,
commit: Commitment
) -> Result<MerkleProof, String>
[src]
pub fn merkle_proof(
&mut self,
commit: Commitment
) -> Result<MerkleProof, String>
build a new merkle proof for the given position.
pub fn compact(&mut self) -> Result<(), Error>
[src]
pub fn compact(&mut self) -> Result<(), Error>
Compact the MMR data files and flush the rm logs
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T> SafeBorrow for T where
T: ?Sized,
impl<T> SafeBorrow for T where
T: ?Sized,
fn borrow_replacement(ptr: &T) -> &T
fn borrow_replacement(ptr: &T) -> &T
impl<T> UnsafeAny for T where
T: Any,
impl<T> UnsafeAny for T where
T: Any,
impl<T> Erased for T
impl<T> Erased for T
impl<T> Same for T
impl<T> Same for T
type Output = T
Should always be Self