diff --git a/ethereum/src/consensus.rs b/ethereum/src/consensus.rs index 17692636..0b35f849 100644 --- a/ethereum/src/consensus.rs +++ b/ethereum/src/consensus.rs @@ -11,7 +11,7 @@ use alloy::rpc::types::{Block, BlockTransactions, Header, Transaction}; use chrono::Duration; use eyre::eyre; use eyre::Result; -use futures::future::join_all; + use tracing::{debug, error, info, warn}; use tree_hash::TreeHash; use url::Url; @@ -143,6 +143,15 @@ impl, DB: Database> ConsensusClient> Inner { } } - pub async fn get_payloads( - &self, - start_slot: u64, - end_slot: u64, - ) -> Result>> { - let payloads_fut = (start_slot..end_slot) - .rev() - .map(|slot| self.rpc.get_block(slot)); - - let mut prev_parent_hash: B256 = *self - .rpc - .get_block(end_slot) - .await? - .body - .execution_payload() - .parent_hash(); - - let mut payloads: Vec> = Vec::new(); - for result in join_all(payloads_fut).await { - if result.is_err() { - continue; - } - let payload = result.unwrap().body.execution_payload().clone(); - if payload.block_hash() != &prev_parent_hash { - warn!( - target: "helios::consensus", - error = %ConsensusError::InvalidHeaderHash( - prev_parent_hash, - *payload.parent_hash(), - ), - "error while backfilling blocks" - ); - break; - } - prev_parent_hash = *payload.parent_hash(); - payloads.push(payload); - } - Ok(payloads) - } - pub async fn sync(&mut self, checkpoint: B256) -> Result<()> { self.store = LightClientStore::default(); self.last_checkpoint = None;