#[non_exhaustive]pub struct BeaconChainHeader<'a> { /* private fields */ }
Expand description
Block header that corresponds to the beacon chain
Implementations§
Source§impl<'a> BeaconChainHeader<'a>
impl<'a> BeaconChainHeader<'a>
Sourcepub fn try_from_bytes(bytes: &'a [u8]) -> Option<(Self, &'a [u8])>
pub fn try_from_bytes(bytes: &'a [u8]) -> Option<(Self, &'a [u8])>
Try to create a new instance from provided bytes.
bytes
should be 8-bytes aligned.
Returns an instance and remaining bytes on success, None
if too few bytes were given,
bytes are not properly aligned or input is otherwise invalid.
Sourcepub fn is_internally_consistent(&self) -> bool
pub fn is_internally_consistent(&self) -> bool
Check block header’s internal consistency.
This is usually not necessary to be called explicitly since internal consistency is checked
by Self::try_from_bytes()
internally.
Sourcepub fn try_from_bytes_unchecked(bytes: &'a [u8]) -> Option<(Self, &'a [u8])>
pub fn try_from_bytes_unchecked(bytes: &'a [u8]) -> Option<(Self, &'a [u8])>
The same as Self::try_from_bytes()
, but for trusted input that skips some consistency
checks
Sourcepub fn to_owned(self) -> OwnedBeaconChainHeader
pub fn to_owned(self) -> OwnedBeaconChainHeader
Create an owned version of this header
Shared block header
Sourcepub fn child_shard_blocks(&self) -> &BlockHeaderChildShardBlocks<'a>
pub fn child_shard_blocks(&self) -> &BlockHeaderChildShardBlocks<'a>
Information about child shard blocks
Sourcepub fn consensus_parameters(&self) -> &BlockHeaderConsensusParameters<'a>
pub fn consensus_parameters(&self) -> &BlockHeaderConsensusParameters<'a>
Consensus parameters (on the beacon chain)
Sourcepub fn pre_seal_hash(&self) -> Blake3Hash
pub fn pre_seal_hash(&self) -> Blake3Hash
Hash of the block before seal is applied to it
Sourcepub fn is_sealed_correctly(&self) -> bool
pub fn is_sealed_correctly(&self) -> bool
Verify seal against BeaconChainHeader::pre_seal_hash()
and check that its public key
hash corresponds to the solution
Sourcepub fn root(&self) -> impl Deref<Target = BlockRoot>
pub fn root(&self) -> impl Deref<Target = BlockRoot>
Compute block root out of this header.
Block root is a Merkle Tree Root. The leaves are derived from individual fields in
SharedBlockHeader
and other fields of this enum in the declaration order.
Note that this method computes root by doing a bunch of hashing. The result is then cached
if alloc
feature is enabled or when compiled for OS target that is not none
.
Trait Implementations§
Source§impl<'a> Clone for BeaconChainHeader<'a>
impl<'a> Clone for BeaconChainHeader<'a>
Source§fn clone(&self) -> BeaconChainHeader<'a>
fn clone(&self) -> BeaconChainHeader<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'a> Debug for BeaconChainHeader<'a>
impl<'a> Debug for BeaconChainHeader<'a>
Source§impl<'a> Deref for BeaconChainHeader<'a>
impl<'a> Deref for BeaconChainHeader<'a>
Source§impl<'a> From<BeaconChainHeader<'a>> for BlockHeader<'a>
impl<'a> From<BeaconChainHeader<'a>> for BlockHeader<'a>
Source§fn from(value: BeaconChainHeader<'a>) -> Self
fn from(value: BeaconChainHeader<'a>) -> Self
Source§impl<'a> GenericBlockHeader<'a> for BeaconChainHeader<'a>
impl<'a> GenericBlockHeader<'a> for BeaconChainHeader<'a>
Source§impl<'a> Yokeable<'a> for BeaconChainHeader<'static>
impl<'a> Yokeable<'a> for BeaconChainHeader<'static>
Source§type Output = BeaconChainHeader<'a>
type Output = BeaconChainHeader<'a>
Self
with the 'static
replaced with 'a
, i.e. Self<'a>
Source§fn transform_owned(self) -> Self::Output
fn transform_owned(self) -> Self::Output
Source§unsafe fn make(this: Self::Output) -> Self
unsafe fn make(this: Self::Output) -> Self
Self<'a>
’s lifetime. Read moreSource§fn transform_mut<F>(&'a mut self, f: F)where
F: 'static + for<'b> FnOnce(&'b mut Self::Output),
fn transform_mut<F>(&'a mut self, f: F)where
F: 'static + for<'b> FnOnce(&'b mut Self::Output),
self
between &'a mut Self<'static>
and &'a mut Self<'a>
,
and pass it to f
. Read moreAuto Trait Implementations§
impl<'a> Freeze for BeaconChainHeader<'a>
impl<'a> !RefUnwindSafe for BeaconChainHeader<'a>
impl<'a> Send for BeaconChainHeader<'a>
impl<'a> Sync for BeaconChainHeader<'a>
impl<'a> Unpin for BeaconChainHeader<'a>
impl<'a> !UnwindSafe for BeaconChainHeader<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more