Skip to content

Commit cb2e0bf

Browse files
committed
fix: use RFC 5737 TEST-NET-1 IP for timeout testing
1 parent 3884314 commit cb2e0bf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

dash-spv/tests/handshake_test.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,15 @@ async fn test_handshake_with_mainnet_peer() {
5050

5151
#[tokio::test]
5252
async fn test_handshake_timeout() {
53-
// Test connecting to a non-routable IP to verify timeout behavior
54-
// Using a non-routable IP that will cause the connection to hang
55-
let peer_addr: SocketAddr = "10.255.255.1:9999".parse().expect("Valid peer address");
53+
// Test connection timeout behavior using TEST-NET-1 from RFC 5737.
54+
// https://datatracker.ietf.org/doc/html/rfc5737
55+
// This IP range is reserved for documentation and will never respond.
56+
let peer_addr: SocketAddr = "192.0.2.1:9999".parse().expect("Valid peer address");
5657
let start = std::time::Instant::now();
5758
let result = Peer::connect(peer_addr, 2, Network::Dash).await;
5859
let elapsed = start.elapsed();
5960

60-
assert!(result.is_err(), "Connection should fail for non-routable peer");
61+
assert!(result.is_err(), "Connection should fail for unreachable peer");
6162
assert!(
6263
elapsed >= Duration::from_secs(1),
6364
"Should respect timeout duration (elapsed: {:?})",

0 commit comments

Comments
 (0)