Skip to content

Commit cbe4044

Browse files
committed
Fix the network unreachable test panic
1 parent 46636f9 commit cbe4044

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

consensus/tests/sync_utils.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,10 @@ pub async fn sync_two_peers_across_protocol_upgrades(sync_mode: SyncMode, num_up
326326
expected_upgrades.push((upgrade_hash, upgrade_version));
327327
}
328328

329+
let peer_id_base = 10_000 + num_upgrades as u64 * 10;
330+
329331
let net1: Arc<Network> =
330-
TestNetwork::build_network(40, Default::default(), &mut Some(hub)).await;
332+
TestNetwork::build_network(peer_id_base, Default::default(), &mut Some(hub)).await;
331333
networks.push(Arc::clone(&net1));
332334
let blockchain1_proxy = BlockchainProxy::from(&blockchain1);
333335
let syncer1 = SyncerProxy::new_history(
@@ -365,13 +367,17 @@ pub async fn sync_two_peers_across_protocol_upgrades(sync_mode: SyncMode, num_up
365367
let mut upgrade_events = events
366368
.filter(|event| future::ready(matches!(event, BlockchainEvent::ProtocolUpgrade(_, _))));
367369

368-
let net2: Arc<Network> =
369-
TestNetwork::build_network(41, Default::default(), &mut Some(MockHub::default())).await;
370+
let net2: Arc<Network> = TestNetwork::build_network(
371+
peer_id_base + 1,
372+
Default::default(),
373+
&mut Some(MockHub::default()),
374+
)
375+
.await;
370376
networks.push(Arc::clone(&net2));
371377

372378
let mut syncer2 = syncer(&sync_mode, &net2, &blockchain2_proxy).await;
373379

374-
Network::connect_networks(&networks, 41).await;
380+
Network::connect_networks(&networks, peer_id_base + 1).await;
375381

376382
let macro_sync_result = match syncer2 {
377383
SyncerProxy::History(ref mut syncer) => syncer.macro_sync.next().await,

0 commit comments

Comments
 (0)