Struct casper_node::types::BlockHeader
source · pub struct BlockHeader { /* private fields */ }
Expand description
The header portion of a Block
.
Implementations§
source§impl BlockHeader
impl BlockHeader
sourcepub fn parent_hash(&self) -> &BlockHash
pub fn parent_hash(&self) -> &BlockHash
The parent block’s hash.
sourcepub fn state_root_hash(&self) -> &Digest
pub fn state_root_hash(&self) -> &Digest
The root hash of the resulting global state.
sourcepub fn random_bit(&self) -> bool
pub fn random_bit(&self) -> bool
A random bit needed for initializing a future era.
sourcepub fn accumulated_seed(&self) -> Digest
pub fn accumulated_seed(&self) -> Digest
A seed needed for initializing a future era.
sourcepub fn era_end(&self) -> Option<&EraEnd>
pub fn era_end(&self) -> Option<&EraEnd>
Returns the EraEnd
of a block if it is a switch block.
sourcepub fn next_block_era_id(&self) -> EraId
pub fn next_block_era_id(&self) -> EraId
Returns the era ID in which the next block would be created (that is, this block’s era ID, or its successor if this is a switch block).
sourcepub fn protocol_version(&self) -> ProtocolVersion
pub fn protocol_version(&self) -> ProtocolVersion
Returns the protocol version of the network from when this block was created.
sourcepub fn is_switch_block(&self) -> bool
pub fn is_switch_block(&self) -> bool
Returns true
if this block is the last one in the current era.
sourcepub fn next_era_validator_weights(&self) -> Option<&BTreeMap<PublicKey, U512>>
pub fn next_era_validator_weights(&self) -> Option<&BTreeMap<PublicKey, U512>>
The validators for the upcoming era and their respective weights (if this is a switch block).
sourcepub fn maybe_take_next_era_validator_weights(
self
) -> Option<BTreeMap<PublicKey, U512>>
pub fn maybe_take_next_era_validator_weights( self ) -> Option<BTreeMap<PublicKey, U512>>
Takes the validators for the upcoming era and their respective weights (if this is a switch block).
sourcepub fn block_hash(&self) -> BlockHash
pub fn block_hash(&self) -> BlockHash
Hash of the block header.
Trait Implementations§
source§impl Clone for BlockHeader
impl Clone for BlockHeader
source§fn clone(&self) -> BlockHeader
fn clone(&self) -> BlockHeader
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl DataSize for BlockHeader
impl DataSize for BlockHeader
source§const IS_DYNAMIC: bool = true
const IS_DYNAMIC: bool = true
If
true
, the type has a heap size that can vary at runtime, depending on the actual value.source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
The amount of space a value of the type always occupies. If
IS_DYNAMIC
is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Estimates the size of heap memory taken up by this value. Read more
source§fn estimate_detailed_heap_size(&self) -> MemUsageNode
fn estimate_detailed_heap_size(&self) -> MemUsageNode
Create a tree of memory estimations. Read more
source§impl Debug for BlockHeader
impl Debug for BlockHeader
source§impl<'de> Deserialize<'de> for BlockHeader
impl<'de> Deserialize<'de> for BlockHeader
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for BlockHeader
impl Display for BlockHeader
source§impl From<BlockHeader> for JsonBlockHeader
impl From<BlockHeader> for JsonBlockHeader
source§fn from(block_header: BlockHeader) -> Self
fn from(block_header: BlockHeader) -> Self
Converts to this type from the input type.
source§impl From<JsonBlockHeader> for BlockHeader
impl From<JsonBlockHeader> for BlockHeader
source§fn from(block_header: JsonBlockHeader) -> Self
fn from(block_header: JsonBlockHeader) -> Self
Converts to this type from the input type.
source§impl FromBytes for BlockHeader
impl FromBytes for BlockHeader
source§impl PartialEq for BlockHeader
impl PartialEq for BlockHeader
source§fn eq(&self, other: &BlockHeader) -> bool
fn eq(&self, other: &BlockHeader) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for BlockHeader
impl Serialize for BlockHeader
source§impl ToBytes for BlockHeader
impl ToBytes for BlockHeader
source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Returns the length of the
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.impl Eq for BlockHeader
Auto Trait Implementations§
impl RefUnwindSafe for BlockHeader
impl Send for BlockHeader
impl Sync for BlockHeader
impl Unpin for BlockHeader
impl UnwindSafe for BlockHeader
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
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.