[][src]Struct grin_chain::txhashset::Extension

pub struct Extension<'a> { /* fields omitted */ }

Allows the application of new blocks on top of the txhashset in a reversible manner within a unit of work provided by the extending function.

Methods

impl<'a> Extension<'a>[src]

pub fn head(&self) -> Tip[src]

The head representing the furthest extent of the current extension.

pub fn utxo_view(&'a self, header_ext: &'a HeaderExtension<'a>) -> UTXOView<'a>[src]

Build a view of the current UTXO set based on the output PMMR and the provided header extension.

pub fn apply_block(
    &mut self,
    b: &Block,
    batch: &Batch
) -> Result<Vec<CommitPos>, Error>
[src]

Apply a new block to the current txhashet extension (output, rangeproof, kernel MMRs). Returns a vec of commit_pos representing the pos and height of the outputs spent by this block.

pub fn merkle_proof(
    &self,
    output: &OutputIdentifier,
    batch: &Batch
) -> Result<MerkleProof, Error>
[src]

Build a Merkle proof for the given output and the block this extension is currently referencing. Note: this relies on the MMR being stable even after pruning/compaction. We need the hash of each sibling pos from the pos up to the peak including the sibling leaf node which may have been removed.

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

Saves a snapshot of the output and rangeproof MMRs to disk. Specifically - saves a snapshot of the utxo file, tagged with the block hash as filename suffix. Needed for fast-sync (utxo file needs to be rewound before sending across).

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

Rewinds the MMRs to the provided block, rewinding to the last output pos and last kernel pos of that block.

pub fn roots(&self) -> Result<TxHashSetRoots, Error>[src]

Current root hashes and sums (if applicable) for the Output, range proof and kernel MMRs.

pub fn validate_roots(&self, header: &BlockHeader) -> Result<(), Error>[src]

Validate the MMR (output, rangeproof, kernel) roots against the latest header.

pub fn validate_sizes(&self, header: &BlockHeader) -> Result<(), Error>[src]

Validate the header, output and kernel MMR sizes against the block header.

pub fn validate_kernel_sums(
    &self,
    genesis: &BlockHeader,
    header: &BlockHeader
) -> Result<(Commitment, Commitment), Error>
[src]

Validate full kernel sums against the provided header (for overage and kernel_offset). This is an expensive operation as we need to retrieve all the UTXOs and kernels from the respective MMRs. For a significantly faster way of validating full kernel sums see BlockSums.

pub fn validate(
    &self,
    genesis: &BlockHeader,
    fast_validation: bool,
    status: &dyn TxHashsetWriteStatus,
    header: &BlockHeader
) -> Result<(Commitment, Commitment), Error>
[src]

Validate the txhashset state against the provided block header. A "fast validation" will skip rangeproof verification and kernel signature verification.

pub fn force_rollback(&mut self)[src]

Force the rollback of this extension, no matter the result

pub fn dump_output_pmmr(&self)[src]

Dumps the output MMR. We use this after compacting for visual confirmation that it worked.

pub fn dump(&self, short: bool)[src]

Dumps the state of the 3 MMRs to stdout for debugging. Short version only prints the Output tree.

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

Sizes of each of the MMRs

Trait Implementations

impl<'a> Committed for Extension<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Extension<'a>

impl<'a> Send for Extension<'a>

impl<'a> Sync for Extension<'a>

impl<'a> Unpin for Extension<'a>

impl<'a> !UnwindSafe for Extension<'a>

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>,