ethcore-network does not use UtilError

This commit is contained in:
debris
2017-09-05 11:14:28 +02:00
parent 2df61d0a8c
commit c623e5f232
2 changed files with 5 additions and 13 deletions

View File

@@ -26,7 +26,6 @@ use std::fmt;
use std::fs;
use std::io::{Read, Write};
use util::hash::*;
use util::UtilError;
use rlp::*;
use time::Tm;
use error::NetworkError;
@@ -58,7 +57,7 @@ impl NodeEndpoint {
pub fn is_allowed(&self, filter: &IpFilter) -> bool {
(self.is_allowed_by_predefined(&filter.predefined) || filter.custom_allow.iter().any(|ipnet| {
self.address.ip().is_within(ipnet)
}))
}))
&& !filter.custom_block.iter().any(|ipnet| {
self.address.ip().is_within(ipnet)
})
@@ -175,7 +174,7 @@ impl FromStr for Node {
type Err = NetworkError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let (id, endpoint) = if s.len() > 136 && &s[0..8] == "enode://" && &s[136..137] == "@" {
(s[8..136].parse().map_err(UtilError::from)?, NodeEndpoint::from_str(&s[137..])?)
(s[8..136].parse().map_err(|_| NetworkError::InvalidNodeId)?, NodeEndpoint::from_str(&s[137..])?)
}
else {
(NodeId::new(), NodeEndpoint::from_str(s)?)