[−][src]Struct grin_chain::txhashset::HeaderExtension
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: &'a Batch<'a>
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]
impl<'a> HeaderExtension<'a>
pub fn apply_header(&mut self, header: &BlockHeader) -> Result<(), Error>
[src]
pub fn apply_header(&mut self, header: &BlockHeader) -> Result<(), Error>
Apply a new header to the header MMR extension. This may be either the header MMR or the sync MMR depending on the extension.
pub fn rewind(&mut self, header: &BlockHeader) -> Result<(), Error>
[src]
pub fn rewind(&mut self, header: &BlockHeader) -> Result<(), Error>
Rewind the header extension to the specified header. Note the close relationship between header height and insertion index.
pub fn truncate(&mut self) -> Result<(), Error>
[src]
pub fn truncate(&mut self) -> Result<(), Error>
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.
pub fn size(&self) -> u64
[src]
pub fn size(&self) -> u64
The size of the header MMR.
pub fn rebuild(
&mut self,
head: &Tip,
genesis: &BlockHeader
) -> Result<(), Error>
[src]
pub fn rebuild(
&mut self,
head: &Tip,
genesis: &BlockHeader
) -> Result<(), Error>
TODO - think about how to optimize this. Requires all header hashes to be iterated over in ascending order.
pub fn root(&self) -> Hash
[src]
pub fn root(&self) -> Hash
The root of the header MMR for convenience.
pub fn validate_root(&self, header: &BlockHeader) -> Result<(), Error>
[src]
pub fn validate_root(&self, header: &BlockHeader) -> Result<(), Error>
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> !Send for HeaderExtension<'a>
impl<'a> !Sync for HeaderExtension<'a>
impl<'a> !Sync for HeaderExtension<'a>
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>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
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
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
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>
try_from
)Performs the conversion.
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
Mutably borrows from an owned value. Read more
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
Given ptr
, which was obtained from a prior call to Self::borrow()
, return a value with the same nominal lifetime which is guaranteed to survive mutations to Self
. Read more
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