Skip to content

Commit

Permalink
add into_single_blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
greged93 committed Jul 3, 2024
1 parent e1d07f3 commit f24c950
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions crates/exex/exex/src/backfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ where
}
}

impl<E, DB, P> BackfillJob<E, DB, P> {
/// Converts the backfill job into a single block backfill job.
pub fn into_single_blocks(self) -> SingleBlockBackfillJob<E, DB, P> {
self.into()
}
}

impl<E, DB, P> From<BackfillJob<E, DB, P>> for SingleBlockBackfillJob<E, DB, P> {
fn from(value: BackfillJob<E, DB, P>) -> Self {
Self {
Expand Down Expand Up @@ -269,7 +276,7 @@ where

#[cfg(test)]
mod tests {
use crate::{BackfillJobFactory, SingleBlockBackfillJob};
use crate::BackfillJobFactory;
use eyre::OptionExt;
use reth_blockchain_tree::noop::NoopBlockchainTree;
use reth_chainspec::{ChainSpec, ChainSpecBuilder, EthereumHardfork, MAINNET};
Expand Down Expand Up @@ -501,7 +508,7 @@ mod tests {
// Backfill the first block
let factory = BackfillJobFactory::new(executor, blockchain_db);
let job = factory.backfill(1..=1);
let single_job: SingleBlockBackfillJob<_, _, _> = job.into();
let single_job = job.into_single_blocks();
let block_execution_it = single_job.into_iter();

// Assert that the backfill job only produces a single block
Expand Down

0 comments on commit f24c950

Please sign in to comment.