mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: use BlockWithParent for StageError (#13198)
This commit is contained in:
@ -1,7 +1,11 @@
|
||||
//! Generators for different data structures like block headers, block bodies and ranges of those.
|
||||
|
||||
use alloy_consensus::{Header, Transaction as _, TxLegacy};
|
||||
use alloy_eips::eip4895::{Withdrawal, Withdrawals};
|
||||
use alloy_eips::{
|
||||
eip1898::BlockWithParent,
|
||||
eip4895::{Withdrawal, Withdrawals},
|
||||
NumHash,
|
||||
};
|
||||
use alloy_primitives::{Address, BlockNumber, Bytes, TxKind, B256, U256};
|
||||
pub use rand::Rng;
|
||||
use rand::{
|
||||
@ -95,6 +99,15 @@ pub fn random_header_range<R: Rng>(
|
||||
headers
|
||||
}
|
||||
|
||||
/// Generate a random [`BlockWithParent`].
|
||||
pub fn random_block_with_parent<R: Rng>(
|
||||
rng: &mut R,
|
||||
number: u64,
|
||||
parent: Option<B256>,
|
||||
) -> BlockWithParent {
|
||||
BlockWithParent { parent: parent.unwrap_or_default(), block: NumHash::new(number, rng.gen()) }
|
||||
}
|
||||
|
||||
/// Generate a random [`SealedHeader`].
|
||||
///
|
||||
/// The header is assumed to not be correct if validated.
|
||||
|
||||
Reference in New Issue
Block a user