diff --git a/beacon_node/network/Cargo.toml b/beacon_node/network/Cargo.toml index a5cc12bbc55..c37b0fa45d7 100644 --- a/beacon_node/network/Cargo.toml +++ b/beacon_node/network/Cargo.toml @@ -48,4 +48,8 @@ operation_pool = { path = "../operation_pool" } execution_layer = { path = "../execution_layer" } beacon_processor = { path = "../beacon_processor" } parking_lot = "0.12.0" -environment = { path = "../../lighthouse/environment" } \ No newline at end of file +environment = { path = "../../lighthouse/environment" } + +[features] +# NOTE: This can be run via cargo build --bin lighthouse --features network/disable-backfill +disable-backfill = [] diff --git a/beacon_node/network/src/service.rs b/beacon_node/network/src/service.rs index c2719477f1f..b517d57df3b 100644 --- a/beacon_node/network/src/service.rs +++ b/beacon_node/network/src/service.rs @@ -232,6 +232,12 @@ impl NetworkService { // build the channels for external comms let (network_senders, network_recievers) = NetworkSenders::new(); + #[cfg(feature = "disable-backfill")] + warn!( + network_log, + "Backfill is disabled. DO NOT RUN IN PRODUCTION" + ); + // try and construct UPnP port mappings if required. if let Some(upnp_config) = crate::nat::UPnPConfig::from_config(config) { let upnp_log = network_log.new(o!("service" => "UPnP")); diff --git a/beacon_node/network/src/sync/manager.rs b/beacon_node/network/src/sync/manager.rs index 72542752c51..670e88eac5e 100644 --- a/beacon_node/network/src/sync/manager.rs +++ b/beacon_node/network/src/sync/manager.rs @@ -395,6 +395,7 @@ impl SyncManager { // If we would otherwise be synced, first check if we need to perform or // complete a backfill sync. + #[cfg(not(feature = "disable_backfill"))] if matches!(sync_state, SyncState::Synced) { // Determine if we need to start/resume/restart a backfill sync. match self.backfill_sync.start(&mut self.network) { @@ -419,6 +420,7 @@ impl SyncManager { } Some((RangeSyncType::Finalized, start_slot, target_slot)) => { // If there is a backfill sync in progress pause it. + #[cfg(not(feature = "disable_backfill"))] self.backfill_sync.pause(); SyncState::SyncingFinalized { @@ -428,6 +430,7 @@ impl SyncManager { } Some((RangeSyncType::Head, start_slot, target_slot)) => { // If there is a backfill sync in progress pause it. + #[cfg(not(feature = "disable_backfill"))] self.backfill_sync.pause(); SyncState::SyncingHead {