Skip to content

Commit

Permalink
add network globals to da checker
Browse files Browse the repository at this point in the history
  • Loading branch information
eserilev committed Mar 19, 2024
1 parent 63548b9 commit 230e9a8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
10 changes: 9 additions & 1 deletion beacon_node/beacon_chain/src/data_availability_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::data_availability_checker::overflow_lru_cache::OverflowLRUCache;
use crate::data_availability_checker::processing_cache::ProcessingCache;
use crate::{BeaconChain, BeaconChainTypes, BeaconStore};
use kzg::Kzg;
use lighthouse_network::NetworkGlobals;
use lighthouse_network::{Enr, NetworkGlobals};
use parking_lot::RwLock;
pub use processing_cache::ProcessingComponents;
use slasher::test_utils::E;
Expand Down Expand Up @@ -113,6 +113,14 @@ impl<T: BeaconChainTypes> DataAvailabilityChecker<T> {
let _ = self.network_globals.write().insert(network_globals);
}

pub fn get_local_enr(&self) -> Option<Enr> {
if let Some(network_globals) = self.network_globals.read().as_ref().or(None) {
return Some(network_globals.local_enr());
}

None
}

/// Get the processing info for a block.
pub fn get_processing_components(
&self,
Expand Down
10 changes: 10 additions & 0 deletions beacon_node/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ fn http_server_genesis_state() {

let node = build_node(&mut env);

let beacon_chain = node
.client
.beacon_chain()
.expect("client should have beacon chain");

beacon_chain
.data_availability_checker
.get_local_enr()
.expect("da checker should have access to network globals");

let remote_node = node.remote_node().expect("should produce remote node");

let api_state = env
Expand Down

0 comments on commit 230e9a8

Please sign in to comment.