(cherry picked from commit 0924c2d070)
Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#![allow(clippy::integer_arithmetic)]
|
||||
pub use solana_core::test_validator;
|
||||
pub use solana_core::{cluster_info::MINIMUM_VALIDATOR_PORT_RANGE_WIDTH, test_validator};
|
||||
use {
|
||||
console::style,
|
||||
indicatif::{ProgressBar, ProgressDrawTarget, ProgressStyle},
|
||||
@@ -75,6 +75,22 @@ pub fn port_validator(port: String) -> Result<(), String> {
|
||||
.map_err(|e| format!("{:?}", e))
|
||||
}
|
||||
|
||||
pub fn port_range_validator(port_range: String) -> Result<(), String> {
|
||||
if let Some((start, end)) = solana_net_utils::parse_port_range(&port_range) {
|
||||
if end - start < MINIMUM_VALIDATOR_PORT_RANGE_WIDTH {
|
||||
Err(format!(
|
||||
"Port range is too small. Try --dynamic-port-range {}-{}",
|
||||
start,
|
||||
start + MINIMUM_VALIDATOR_PORT_RANGE_WIDTH
|
||||
))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
} else {
|
||||
Err("Invalid port range".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a new process bar for processing that will take an unknown amount of time
|
||||
pub fn new_spinner_progress_bar() -> ProgressBar {
|
||||
let progress_bar = ProgressBar::new(42);
|
||||
|
||||
Reference in New Issue
Block a user