diff --git a/core/tests/fork-selection.rs b/core/tests/fork-selection.rs index 21d4ebd4c3..ee8b171a5c 100644 --- a/core/tests/fork-selection.rs +++ b/core/tests/fork-selection.rs @@ -1,13 +1,13 @@ //! Fork Selection Simulation //! -//! Description of the algorithm can be found in [docs/src/fork-selection.md](docs/src/fork-selection.md). +//! Description of the algorithm can be found in [docs/src/cluster/managing-forks.md](docs/src/cluster/managing-forks.md). //! //! A test library function exists for configuring networks. //! ``` //! /// * num_partitions - 1 to 100 partitions //! /// * fail_rate - 0 to 1.0 rate of packet receive failure //! /// * delay_count - number of forks to observe before voting -//! /// * parasite_rate - number of parasite nodes that vote opposite the greedy choice +//! /// * parasite_rate - percentage of parasite nodes that vote opposite the greedy choice //! fn test_with_partitions(num_partitions: usize, fail_rate: f64, delay_count: usize, parasite_rate: f64); //! ``` //! Modify the test function @@ -497,7 +497,7 @@ fn test_no_partitions() { /// * num_partitions - 1 to 100 partitions /// * fail_rate - 0 to 1.0 rate of packet receive failure /// * delay_count - number of forks to observe before voting -/// * parasite_rate - number of parasite nodes that vote opposite the greedy choice +/// * parasite_rate - percentage of parasite nodes that vote opposite the greedy choice fn test_with_partitions( num_partitions: usize, fail_rate: f64, diff --git a/net-utils/src/lib.rs b/net-utils/src/lib.rs index 9bd5839c27..a0b1e51465 100644 --- a/net-utils/src/lib.rs +++ b/net-utils/src/lib.rs @@ -790,4 +790,14 @@ mod tests { 3, )); } + + #[test] + fn test_bind_two_consecutive_in_range() { + solana_logger::setup(); + let ip_addr = IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)); + if let Ok(((port1, _), (port2, _))) = bind_two_consecutive_in_range(ip_addr, (1024, 65535)) + { + assert!(port2 == port1 + 1); + } + } }