Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Removes obsolete is_valid_node_url()
Browse files Browse the repository at this point in the history
  • Loading branch information
0x7CFE committed Nov 6, 2017
1 parent 1516fc1 commit 851401d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ mod api;

pub use api::*;
pub use chain::{SyncStatus, SyncState};
pub use network::{is_valid_node_url, validate_node_url, NonReservedPeerMode, NetworkError, ConnectionFilter, ConnectionDirection};
pub use network::{validate_node_url, NonReservedPeerMode, NetworkError, ConnectionFilter, ConnectionDirection};

#[cfg(test)]
pub(crate) type Address = bigint::hash::H160;
2 changes: 1 addition & 1 deletion util/network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub use session::SessionInfo;
pub use connection_filter::{ConnectionFilter, ConnectionDirection};

pub use io::TimerToken;
pub use node_table::{is_valid_node_url, validate_node_url, NodeId};
pub use node_table::{validate_node_url, NodeId};
use ipnetwork::{IpNetwork, IpNetworkError};
use std::str::FromStr;

Expand Down
8 changes: 1 addition & 7 deletions util/network/src/node_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,6 @@ impl Drop for NodeTable {
}

/// Check if node url is valid
pub fn is_valid_node_url(url: &str) -> bool {
use std::str::FromStr;
Node::from_str(url).is_ok()
}

/// Same as `is_valid_node_url` but returns detailed `NetworkError`
pub fn validate_node_url(url: &str) -> Option<NetworkError> {
use std::str::FromStr;
match Node::from_str(url) {
Expand Down Expand Up @@ -399,7 +393,7 @@ mod tests {

#[test]
fn node_parse() {
assert!(is_valid_node_url("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770"));
assert!(validate_node_url("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770").is_some());
let node = Node::from_str("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770");
assert!(node.is_ok());
let node = node.unwrap();
Expand Down

0 comments on commit 851401d

Please sign in to comment.