Struct common_types::header::Header
source · [−]pub struct Header { /* private fields */ }
Expand description
A block header.
Reflects the specific RLP fields of a block in the chain with additional room for the seal which is non-specific.
Doesn’t do all that much on its own.
Two versions of header exist. First one is before EIP1559. Second version is after EIP1559. EIP1559 version added field base_fee_per_gas.
Implementations
sourceimpl Header
impl Header
sourcepub fn parent_hash(&self) -> &H256
pub fn parent_hash(&self) -> &H256
Get the parent_hash field of the header.
sourcepub fn number(&self) -> BlockNumber
pub fn number(&self) -> BlockNumber
Get the number field of the header.
Get the author field of the header.
sourcepub fn extra_data(&self) -> &Bytes
pub fn extra_data(&self) -> &Bytes
Get the extra data field of the header.
sourcepub fn state_root(&self) -> &H256
pub fn state_root(&self) -> &H256
Get the state root field of the header.
sourcepub fn receipts_root(&self) -> &H256
pub fn receipts_root(&self) -> &H256
Get the receipts root field of the header.
sourcepub fn transactions_root(&self) -> &H256
pub fn transactions_root(&self) -> &H256
Get the transactions root field of the header.
sourcepub fn uncles_hash(&self) -> &H256
pub fn uncles_hash(&self) -> &H256
Get the uncles hash field of the header.
sourcepub fn difficulty(&self) -> &U256
pub fn difficulty(&self) -> &U256
Get the difficulty field of the header.
sourcepub fn decode_seal<'a, T: FromIterator<&'a [u8]>>(
&'a self
) -> Result<T, DecoderError>
pub fn decode_seal<'a, T: FromIterator<&'a [u8]>>(
&'a self
) -> Result<T, DecoderError>
Get the seal field with RLP-decoded values as bytes.
sourcepub fn set_parent_hash(&mut self, a: H256)
pub fn set_parent_hash(&mut self, a: H256)
Set the number field of the header.
sourcepub fn set_uncles_hash(&mut self, a: H256)
pub fn set_uncles_hash(&mut self, a: H256)
Set the uncles hash field of the header.
sourcepub fn set_state_root(&mut self, a: H256)
pub fn set_state_root(&mut self, a: H256)
Set the state root field of the header.
sourcepub fn set_transactions_root(&mut self, a: H256)
pub fn set_transactions_root(&mut self, a: H256)
Set the transactions root field of the header.
sourcepub fn set_receipts_root(&mut self, a: H256)
pub fn set_receipts_root(&mut self, a: H256)
Set the receipts root field of the header.
sourcepub fn set_log_bloom(&mut self, a: Bloom)
pub fn set_log_bloom(&mut self, a: Bloom)
Set the log bloom field of the header.
sourcepub fn set_timestamp(&mut self, a: u64)
pub fn set_timestamp(&mut self, a: u64)
Set the timestamp field of the header.
sourcepub fn set_number(&mut self, a: BlockNumber)
pub fn set_number(&mut self, a: BlockNumber)
Set the number field of the header.
Set the author field of the header.
sourcepub fn set_extra_data(&mut self, a: Bytes)
pub fn set_extra_data(&mut self, a: Bytes)
Set the extra data field of the header.
sourcepub fn set_gas_used(&mut self, a: U256)
pub fn set_gas_used(&mut self, a: U256)
Set the gas used field of the header.
sourcepub fn set_gas_limit(&mut self, a: U256)
pub fn set_gas_limit(&mut self, a: U256)
Set the gas limit field of the header.
sourcepub fn set_difficulty(&mut self, a: U256)
pub fn set_difficulty(&mut self, a: U256)
Set the difficulty field of the header.
sourcepub fn compute_hash(&mut self) -> H256
pub fn compute_hash(&mut self) -> H256
Get & memoize the hash of this header (keccak of the RLP with seal).
sourcepub fn set_base_fee(&mut self, a: Option<U256>)
pub fn set_base_fee(&mut self, a: Option<U256>)
Set the block base fee of the header.
sourceimpl Header
impl Header
pub fn decode_rlp(
r: &Rlp<'_>,
eip1559_transition: BlockNumber
) -> Result<Self, DecoderError>
pub fn decode_rlp_list(
rlp: &Rlp<'_>,
eip1559_transition: BlockNumber
) -> Result<Vec<Self>, DecoderError>
Trait Implementations
sourceimpl MallocSizeOf for Header
impl MallocSizeOf for Header
sourcefn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
If T::size_of
is a constant, consider implementing constant_size
as well. Read more
sourcefn constant_size() -> Option<usize>
fn constant_size() -> Option<usize>
Used to optimize MallocSizeOf
implementation for collections
like Vec
and HashMap
to avoid iterating over them unnecessarily.
The Self: Sized
bound is for object safety. Read more
impl Eq for Header
impl StructuralEq for Header
Auto Trait Implementations
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> MallocSizeOfExt for T where
T: MallocSizeOf,
impl<T> MallocSizeOfExt for T where
T: MallocSizeOf,
sourcefn malloc_size_of(&self) -> usize
fn malloc_size_of(&self) -> usize
Method to launch a heapsize measurement with a fresh state. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more