pub(crate) async fn fallback_block_fetcher(
        &self,
        ctx: &ctx::Ctx,
        store: &Store,
    ) -> ctx::Result<()> {
        const MAX_CONCURRENT_REQUESTS: usize = 30;
        scope::run!(ctx, |ctx, s| async {
            let (send, mut recv) = ctx::channel::bounded(MAX_CONCURRENT_REQUESTS);
            // TODO: metrics.
            s.spawn::<()>(async {
                let send = send;
                let is_lagging =
                    |main| main >= store.persisted().borrow().next() + FALLBACK_FETCHER_THRESHOLD;
                let mut next = store.next_block(ctx).await.wrap("next_block()")?;
                loop {
                    // Wait until p2p syncing is lagging.
                    wait_for_main_node_block(ctx, &self.sync_state, is_lagging).await?;
                    // Determine the next block to fetch and wait for it to be available.
                    next = next.max(store.next_block(ctx).await.wrap("next_block()")?);
                    wait_for_main_node_block(ctx, &self.sync_state, |main| main >= next).await?;
                    // Fetch the block asynchronously.
                    send.send(ctx, s.spawn(self.fetch_block(ctx, next))).await?;
                    next = next.next();
                }
            });
            loop {
                let block = recv.recv(ctx).await?;
                store
                    .queue_next_fetched_block(ctx, block.join(ctx).await?)
                    .await
                    .wrap("queue_next_fetched_block()")?;
            }
        })
        .await
    }
Fetches blocks from the main node directly whenever the EN is lagging behind too much.
core/node/consensus/src/en.rs