[][src]Struct grin_chain::txhashset::HeaderExtension

pub struct HeaderExtension<'a> {
    pub batch: &'a Batch<'a>,
    // some fields omitted
}

A header extension to allow the header MMR to extend beyond the other MMRs individually. This is to allow headers to be validated against the MMR before we have the full block data.

Fields

Batch in which the extension occurs, public so it can be used within an extending closure. Just be careful using it that way as it will get rolled back with the extension (i.e on a losing fork).

Methods

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

Get the header at the specified height based on the current state of the header extension. Derives the MMR pos from the height (insertion index) and retrieves the header hash. Looks the header up in the db by hash.

Compares the provided header to the header in the header MMR at that height. If these match we know the header is on the current chain.

Force the rollback of this extension, no matter the result.

Apply a new header to the header MMR extension. This may be either the header MMR or the sync MMR depending on the extension.

Rewind the header extension to the specified header. Note the close relationship between header height and insertion index.

Truncate the header MMR (rewind all the way back to pos 0). Used when rebuilding the header MMR by reapplying all headers including the genesis block header.

The size of the header MMR.

TODO - think about how to optimize this. Requires all header hashes to be iterated over in ascending order.

The root of the header MMR for convenience.

Validate the prev_root of the header against the root of the current header MMR.

Auto Trait Implementations

impl<'a> !Send for HeaderExtension<'a>

impl<'a> !Sync for HeaderExtension<'a>

Blanket Implementations

impl<T> From for T
[src]

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

impl<T> UnsafeAny for T where
    T: Any

impl<T> Erased for T

impl<T> Same for T

Should always be Self