Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/ethrex/l2/initializers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use ethrex_p2p::{
discv4::peer_table::PeerTable,
network::P2PContext,
peer_handler::PeerHandler,
rlpx::{initiator::RLPxInitiator, l2::l2_connection::P2PBasedContext},
rlpx::l2::l2_connection::P2PBasedContext,
sync_manager::SyncManager,
types::{Node, NodeRecord},
};
Expand Down Expand Up @@ -233,8 +233,8 @@ pub async fn init_l2(
.await
.expect("P2P context could not be created");

let initiator = RLPxInitiator::spawn(p2p_context.clone()).await;
let peer_handler = PeerHandler::new(PeerTable::spawn(opts.node_opts.target_peers), initiator);
// We don't need the peer_handler in L2.
let peer_handler = PeerHandler::dummy().await;

let cancel_token = tokio_util::sync::CancellationToken::new();

Expand Down
4 changes: 2 additions & 2 deletions crates/networking/p2p/peer_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ impl PeerHandler {
}
}

#[cfg(any(test, feature = "test-utils"))]
#[cfg(any(test, feature = "test-utils", feature = "l2"))]
/// Creates a dummy PeerHandler for tests where interacting with peers is not needed
/// This should only be used in tests as it won't be able to interact with the node's connected peers
/// This should only be used in tests or L2 as it won't be able to interact with the node's connected peers
pub async fn dummy() -> PeerHandler {
let peer_table = PeerTable::spawn(TARGET_PEERS);
PeerHandler::new(peer_table.clone(), RLPxInitiator::dummy(peer_table).await)
Expand Down
4 changes: 2 additions & 2 deletions crates/networking/p2p/rlpx/initiator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ impl RLPxInitiator {
}
}

#[cfg(any(test, feature = "test-utils"))]
#[cfg(any(test, feature = "test-utils", feature = "l2"))]
/// Creates a dummy GenServer for tests
/// This should only be used in tests
/// This should only be used in tests or L2
pub async fn dummy(peer_table: PeerTable) -> GenServerHandle<RLPxInitiator> {
info!("Starting RLPx Initiator");
let state = RLPxInitiator::new(P2PContext::dummy(peer_table).await);
Expand Down
Loading