Skip to content

Commit a891b78

Browse files
authored
fix(l2): peer table duplication (#5227)
**Motivation** PR #5004 led to changes in `init_l2()` that weren't properly updated, so now when initializing L2 there are 2 Peer Tables. **Description** This pr uses the Peer Table created in the first place to initialize the Peer Handler instead of creating a new one. It also updates the gen server initialization for the gen server dummy.
1 parent 16b4297 commit a891b78

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cmd/ethrex/l2/initializers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ pub async fn init_l2(
234234
.expect("P2P context could not be created");
235235

236236
let initiator = RLPxInitiator::spawn(p2p_context.clone()).await;
237-
let peer_handler = PeerHandler::new(PeerTable::spawn(opts.node_opts.target_peers), initiator);
237+
let peer_handler = PeerHandler::new(peer_table, initiator);
238238

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

crates/networking/p2p/rlpx/initiator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl RLPxInitiator {
8585
pub async fn dummy(peer_table: PeerTable) -> GenServerHandle<RLPxInitiator> {
8686
info!("Starting RLPx Initiator");
8787
let state = RLPxInitiator::new(P2PContext::dummy(peer_table).await);
88-
RLPxInitiator::start_on_thread(state)
88+
RLPxInitiator::start(state)
8989
}
9090
}
9191

0 commit comments

Comments
 (0)