Fix enr loading from disk with cgc (#7754)

N/A


  During building an enr on startup, we weren't using the value in the custody context.
This was resulting in the enr value getting updated when the cgc updates, the change getting persisted, but getting set back to the default on restart.
This PR takes the value explicitly from the custody context.
This commit is contained in:
Pawan Dhananjay
2025-07-17 23:51:11 -05:00
committed by GitHub
parent d6de8a7484
commit 3f06e5dfba
4 changed files with 57 additions and 20 deletions

View File

@@ -197,18 +197,21 @@ impl<E: EthSpec> Network<E> {
.fork_context
.next_fork_digest()
.unwrap_or_else(|| ctx.fork_context.current_fork_digest());
let advertised_cgc = config
.advertise_false_custody_group_count
.unwrap_or(custody_group_count);
let enr = crate::discovery::enr::build_or_load_enr::<E>(
local_keypair.clone(),
&config,
&ctx.enr_fork_id,
Some(advertised_cgc),
next_fork_digest,
&ctx.chain_spec,
)?;
// Construct the metadata
let advertised_cgc = config
.advertise_false_custody_group_count
.unwrap_or(custody_group_count);
let meta_data = utils::load_or_build_metadata(&config.network_dir, advertised_cgc);
let seq_number = *meta_data.seq_number();
let globals = NetworkGlobals::new(