Skip to main content

HeaderMut

Trait HeaderMut 

pub trait HeaderMut: BlockHeader {
    // Required methods
    fn set_parent_hash(&mut self, hash: FixedBytes<32>);
    fn set_block_number(&mut self, number: u64);
    fn set_timestamp(&mut self, timestamp: u64);
    fn set_state_root(&mut self, state_root: FixedBytes<32>);
    fn set_difficulty(&mut self, difficulty: Uint<256, 4>);
    fn set_mix_hash(&mut self, mix_hash: FixedBytes<32>);
    fn set_extra_data(&mut self, extra_data: Bytes);
    fn set_parent_beacon_block_root(
        &mut self,
        parent_beacon_block_root: Option<FixedBytes<32>>,
    );

    // Provided method
    fn set_number(&mut self, number: u64) { ... }
}
Expand description

A helper trait for Headers that allows for mutable access to the headers values.

This allows for modifying the header for testing and mocking purposes.

Required Methods§

fn set_parent_hash(&mut self, hash: FixedBytes<32>)

Updates the parent block hash.

fn set_block_number(&mut self, number: u64)

Updates the block number.

fn set_timestamp(&mut self, timestamp: u64)

Updates the block’s timestamp.

fn set_state_root(&mut self, state_root: FixedBytes<32>)

Updates the block state root.

fn set_difficulty(&mut self, difficulty: Uint<256, 4>)

Updates the block difficulty.

fn set_mix_hash(&mut self, mix_hash: FixedBytes<32>)

Updates the mix hash.

fn set_extra_data(&mut self, extra_data: Bytes)

Updates the extra data.

fn set_parent_beacon_block_root( &mut self, parent_beacon_block_root: Option<FixedBytes<32>>, )

Updates the parent beacon block root.

Provided Methods§

fn set_number(&mut self, number: u64)

Updates the block number (alias for CLI compatibility).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§