pub struct BlockHeader {
    pub pow_hash: Option<H256>,
    pub approximated_rlp_size: usize,
    /* private fields */
}
Expand description

A block header.

Fields§

§pow_hash: Option<H256>

POW quality of the block

§approximated_rlp_size: usize

Approximated rlp size of the block header

Implementations§

source§

impl BlockHeader

source

pub fn approximated_rlp_size(&self) -> usize

Approximated rlp size of the block header.

source

pub fn parent_hash(&self) -> &H256

Get the parent_hash field of the header.

source

pub fn height(&self) -> u64

Get the block height

source

pub fn timestamp(&self) -> u64

Get the timestamp field of the header.

source

pub fn author(&self) -> &Address

Get the author field of the header.

source

pub fn transactions_root(&self) -> &H256

Get the transactions root field of the header.

source

pub fn deferred_state_root(&self) -> &H256

Get the deferred state root field of the header.

source

pub fn deferred_receipts_root(&self) -> &H256

Get the deferred block receipts root field of the header.

source

pub fn deferred_logs_bloom_hash(&self) -> &H256

Get the deferred block logs bloom hash field of the header.

source

pub fn blame(&self) -> u32

Get the blame field of the header

source

pub fn difficulty(&self) -> &U256

Get the difficulty field of the header.

source

pub fn adaptive(&self) -> bool

Get the adaptive field of the header

source

pub fn gas_limit(&self) -> &U256

Get the gas limit field of the header.

source

pub fn core_space_gas_limit(&self) -> U256

source

pub fn espace_gas_limit(&self, can_pack: bool) -> U256

source

pub fn referee_hashes(&self) -> &Vec<H256>

Get the referee hashes field of the header.

source

pub fn custom(&self) -> &Vec<Bytes>

Get the custom data field of the header.

source

pub fn nonce(&self) -> U256

Get the nonce field of the header.

source

pub fn pos_reference(&self) -> &Option<PosBlockId>

Get the PoS reference.

source

pub fn base_price(&self) -> Option<SpaceMap<U256>>

source

pub fn space_base_price(&self, space: Space) -> Option<U256>

source

pub fn set_nonce(&mut self, nonce: U256)

Set the nonce field of the header.

source

pub fn set_timestamp(&mut self, timestamp: u64)

Set the timestamp filed of the header.

source

pub fn set_custom(&mut self, custom: Vec<Bytes>)

Set the custom filed of the header.

source

pub fn compute_hash(&mut self) -> H256

Compute the hash of the block.

source

pub fn hash(&self) -> H256

Get the hash of the block.

source

pub fn problem_hash(&self) -> H256

Get the hash of PoW problem.

source

pub fn rlp_without_nonce(&self) -> Bytes

Get the RLP representation of this header(except nonce).

source

pub fn rlp(&self) -> Bytes

Get the RLP representation of this header.

source

pub fn stream_rlp_with_pow_hash(&self, stream: &mut RlpStream)

Place this header and its pow_hash into an RLP stream stream.

source

pub fn decode_with_pow_hash(bytes: &[u8]) -> Result<Self, DecoderError>

source

pub fn size(&self) -> usize

Trait Implementations§

source§

impl Clone for BlockHeader

source§

fn clone(&self) -> BlockHeader

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BlockHeader

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Decodable for BlockHeader

source§

fn decode(r: &Rlp<'_>) -> Result<Self, DecoderError>

Decode a value from RLP bytes
source§

impl DerefMut for BlockHeader

source§

fn deref_mut(&mut self) -> &mut BlockHeaderRlpPart

Mutably dereferences the value.
source§

impl Encodable for BlockHeader

source§

fn rlp_append(&self, stream: &mut RlpStream)

Append a value to the stream
§

fn rlp_bytes(&self) -> Vec<u8>

Get rlp-encoded bytes for this instance
source§

impl MallocSizeOf for BlockHeader

source§

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.
source§

impl PartialEq for BlockHeader

source§

fn eq(&self, o: &BlockHeader) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Deref for BlockHeader

§

type Target = BlockHeaderRlpPart

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl Eq for BlockHeader

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V