From a44ef73b3381bccafdf9eae57f64df406dca3e22 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 29 Jul 2016 10:22:51 +0200 Subject: [PATCH] Whitespacey lines are not invalid in reserved peers file. Fixes #1622 --- parity/configuration.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parity/configuration.rs b/parity/configuration.rs index 29301dfd3..f14442097 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -350,11 +350,11 @@ impl Configuration { let mut buffer = String::new(); let mut node_file = try!(File::open(path).map_err(|e| format!("Error opening reserved nodes file: {}", e))); try!(node_file.read_to_string(&mut buffer).map_err(|_| "Error reading reserved node file")); - if let Some(invalid) = buffer.lines().find(|s| !is_valid_node_url(s)) { - Err(format!("Invalid node address format given for a boot node: {}", invalid)) - } else { - Ok(buffer.lines().map(|s| s.to_owned()).collect()) + let lines = buffer.lines().map(|s| s.trim().to_owned()).filter(|s| s.len() > 0).collect::>(); + if let Some(invalid) = lines.iter().find(|s| !is_valid_node_url(s)) { + return Err(format!("Invalid node address format given for a boot node: {}", invalid)); } + Ok(lines) }, None => Ok(Vec::new()) }