primitives: use SealedHeader::seal (#12507)

This commit is contained in:
Thomas Coratger
2024-11-13 13:41:56 +01:00
committed by GitHub
parent 527767cc34
commit 9313737dbb
32 changed files with 108 additions and 277 deletions

View File

@ -3,7 +3,6 @@
use alloy_consensus::BlockHeader;
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::Sealable;
use alloy_rpc_types_engine::{JwtError, JwtSecret};
use eyre::Result;
use reth_consensus::Consensus;
@ -44,13 +43,12 @@ where
{
let (peer_id, response) = client.get_header_with_priority(id, Priority::High).await?.split();
let Some(sealed_header) = response.map(|block| block.seal_slow()) else {
let Some(header) = response else {
client.report_bad_message(peer_id);
eyre::bail!("Invalid number of headers received. Expected: 1. Received: 0")
};
let (header, seal) = sealed_header.into_parts();
let header = SealedHeader::new(header, seal);
let header = SealedHeader::seal(header);
let valid = match id {
BlockHashOrNumber::Hash(hash) => header.hash() == hash,