reth_testing_utils::generators

Function random_block

Source
pub fn random_block<R: Rng>(
    rng: &mut R,
    number: u64,
    block_params: BlockParams,
) -> SealedBlock
Expand description

Generate a random block filled with signed transactions (generated using random_signed_tx). If no transaction count is provided, the number of transactions will be random, otherwise the provided count will be used.

All fields use the default values (and are assumed to be invalid) except for:

  • parent_hash
  • transactions_root
  • ommers_hash

Additionally, gas_used and gas_limit always exactly match the total gas_limit of all transactions in the block.

The ommer headers are not assumed to be valid.