pub async fn run_external_node(
    ctx: &ctx::Ctx,
    cfg: Option<(ConsensusConfig, ConsensusSecrets)>,
    pool: zksync_dal::ConnectionPool<Core>,
    sync_state: SyncState,
    main_node_client: Box<DynClient<L2>>,
    actions: ActionQueueSender,
    build_version: semver::Version,
) -> anyhow::Result<()> {
    let en = en::EN {
        pool: storage::ConnectionPool(pool),
        sync_state: sync_state.clone(),
        client: main_node_client.for_component("block_fetcher"),
    };
    let res = match cfg {
        Some((cfg, secrets)) => {
            tracing::info!(
                is_validator = secrets.validator_key.is_some(),
                "running external node"
            );
            en.run(ctx, actions, cfg, secrets, Some(build_version))
                .await
        }
        None => {
            tracing::info!("running fetcher");
            en.run_fetcher(ctx, actions).await
        }
    };
    tracing::info!("Consensus actor stopped");
    res
}
Runs the consensus node for the external node.
If `cfg` is `None`, it will just fetch blocks from the main node
using JSON RPC, without starting the consensus node.
core/node/consensus/src/lib.rs