Skip to content
28 changes: 22 additions & 6 deletions beacon_node/beacon_chain/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,18 +931,26 @@ where

// Load the persisted custody context from the db and initialize
// the context for this run
let custody_context = if let Some(custody) =
let (custody_context, cgc_changed_opt) = if let Some(custody) =
load_custody_context::<E, THotStore, TColdStore>(store.clone())
{
Arc::new(CustodyContext::new_from_persisted_custody_context(
let head_epoch = canonical_head
.cached_head()
.head_slot()
.epoch(E::slots_per_epoch());
CustodyContext::new_from_persisted_custody_context(
custody,
self.node_custody_type,
head_epoch,
&self.spec,
))
)
} else {
Arc::new(CustodyContext::new(self.node_custody_type, &self.spec))
(
CustodyContext::new(self.node_custody_type, &self.spec),
None,
)
};
debug!(?custody_context, "Loading persisted custody context");
debug!(?custody_context, "Loaded persisted custody context");

let beacon_chain = BeaconChain {
spec: self.spec.clone(),
Expand Down Expand Up @@ -1019,7 +1027,7 @@ where
slot_clock,
self.kzg.clone(),
store,
custody_context,
Arc::new(custody_context),
self.spec,
)
.map_err(|e| format!("Error initializing DataAvailabilityChecker: {:?}", e))?,
Expand Down Expand Up @@ -1062,6 +1070,14 @@ where
return Err(format!("Weak subjectivity verification failed: {:?}", e));
}

if let Some(cgc_changed) = cgc_changed_opt {
// Update data column custody info if there's a CGC change from CLI flags.
// This will trigger column backfill.
let cgc_change_effective_slot =
cgc_changed.effective_epoch.start_slot(E::slots_per_epoch());
beacon_chain.update_data_column_custody_info(Some(cgc_change_effective_slot));
}

info!(
head_state = %head.beacon_state_root(),
head_block = %head.beacon_block_root,
Expand Down
Loading
Loading