mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-19 03:04:27 -05:00
fix(net): fix flaky test_trusted_peer_only test (#22213)
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
committed by
GitHub
parent
0dd47af250
commit
f5cf90227b
@@ -12,7 +12,7 @@ use reth_network::{
|
||||
};
|
||||
use reth_network_api::{
|
||||
events::{PeerEvent, SessionInfo},
|
||||
NetworkInfo, Peers, PeersInfo,
|
||||
NetworkInfo, PeerKind, Peers, PeersInfo,
|
||||
};
|
||||
use reth_network_p2p::{
|
||||
headers::client::{HeadersClient, HeadersRequest},
|
||||
@@ -423,6 +423,11 @@ async fn test_trusted_peer_only() {
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
assert_eq!(handle.num_connected_peers(), 1);
|
||||
|
||||
// remove handle from handle1's peer list to prevent a competing outgoing connection attempt
|
||||
// from handle1 racing with handle's outgoing connection below, which can cause duplicate
|
||||
// session resolution to drop a connection
|
||||
handle1.remove_peer(*handle.peer_id(), PeerKind::Basic);
|
||||
|
||||
handle.add_trusted_peer(*handle1.peer_id(), handle1.local_addr());
|
||||
|
||||
// wait for the next session established event to check the handle1 incoming connection
|
||||
|
||||
Reference in New Issue
Block a user