HeaderMut

Trait HeaderMut 

Source
pub trait HeaderMut: BlockHeader {
    // Required methods
    fn set_parent_hash(&mut self, hash: BlockHash);
    fn set_block_number(&mut self, number: BlockNumber);
    fn set_timestamp(&mut self, number: BlockNumber);
    fn set_state_root(&mut self, state_root: B256);
    fn set_difficulty(&mut self, difficulty: U256);

    // 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§

Source

fn set_parent_hash(&mut self, hash: BlockHash)

Updates the parent block hash.

Source

fn set_block_number(&mut self, number: BlockNumber)

Updates the block number.

Source

fn set_timestamp(&mut self, number: BlockNumber)

Updates the block’s timestamp.

Source

fn set_state_root(&mut self, state_root: B256)

Updates the block state root.

Source

fn set_difficulty(&mut self, difficulty: U256)

Updates the block difficulty.

Provided Methods§

Source

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", so this trait is not object safe.

Implementors§