mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
primitives: use SealedHeader::seal (#12507)
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
|
||||
use alloy_consensus::{Transaction as _, TxLegacy};
|
||||
use alloy_eips::eip4895::{Withdrawal, Withdrawals};
|
||||
use alloy_primitives::{Address, BlockNumber, Bytes, Sealable, TxKind, B256, U256};
|
||||
use alloy_primitives::{Address, BlockNumber, Bytes, TxKind, B256, U256};
|
||||
pub use rand::Rng;
|
||||
use rand::{
|
||||
distributions::uniform::SampleRange, rngs::StdRng, seq::SliceRandom, thread_rng, SeedableRng,
|
||||
@ -106,9 +106,7 @@ pub fn random_header<R: Rng>(rng: &mut R, number: u64, parent: Option<B256>) ->
|
||||
parent_hash: parent.unwrap_or_default(),
|
||||
..Default::default()
|
||||
};
|
||||
let sealed = header.seal_slow();
|
||||
let (header, seal) = sealed.into_parts();
|
||||
SealedHeader::new(header, seal)
|
||||
SealedHeader::seal(header)
|
||||
}
|
||||
|
||||
/// Generates a random legacy [Transaction].
|
||||
@ -203,7 +201,7 @@ pub fn random_block<R: Rng>(rng: &mut R, number: u64, block_params: BlockParams)
|
||||
});
|
||||
let withdrawals_root = withdrawals.as_ref().map(|w| proofs::calculate_withdrawals_root(w));
|
||||
|
||||
let sealed = Header {
|
||||
let header = Header {
|
||||
parent_hash: block_params.parent.unwrap_or_default(),
|
||||
number,
|
||||
gas_used: total_gas,
|
||||
@ -215,13 +213,10 @@ pub fn random_block<R: Rng>(rng: &mut R, number: u64, block_params: BlockParams)
|
||||
requests_hash: None,
|
||||
withdrawals_root,
|
||||
..Default::default()
|
||||
}
|
||||
.seal_slow();
|
||||
|
||||
let (header, seal) = sealed.into_parts();
|
||||
};
|
||||
|
||||
SealedBlock {
|
||||
header: SealedHeader::new(header, seal),
|
||||
header: SealedHeader::seal(header),
|
||||
body: BlockBody { transactions, ommers, withdrawals: withdrawals.map(Withdrawals::new) },
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user