From 8e7a08f865715c964dc3dd83d211c2beddb3539f Mon Sep 17 00:00:00 2001
From: Marek Kotewicz <marek.kotewicz@gmail.com>
Date: Tue, 10 Apr 2018 10:13:42 +0200
Subject: [PATCH] ethcore-stratum crate moved to ethcore directory (#8338)

---
 Cargo.toml                                 |  2 +-
 ethcore/Cargo.toml                         |  2 +-
 {stratum => ethcore/stratum}/Cargo.toml    |  5 ++---
 {stratum => ethcore/stratum}/src/lib.rs    | 17 ++++++++---------
 {stratum => ethcore/stratum}/src/traits.rs |  0
 5 files changed, 12 insertions(+), 14 deletions(-)
 rename {stratum => ethcore/stratum}/Cargo.toml (83%)
 rename {stratum => ethcore/stratum}/src/lib.rs (96%)
 rename {stratum => ethcore/stratum}/src/traits.rs (100%)

diff --git a/Cargo.toml b/Cargo.toml
index bb92fff358f..34d347d4533 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -44,7 +44,7 @@ ethcore-miner = { path = "miner" }
 ethcore-network = { path = "util/network" }
 ethcore-private-tx = { path = "ethcore/private-tx" }
 ethcore-service = { path = "ethcore/service" }
-ethcore-stratum = { path = "stratum" }
+ethcore-stratum = { path = "ethcore/stratum" }
 ethcore-transaction = { path = "ethcore/transaction" }
 ethereum-types = "0.3"
 node-filter = { path = "ethcore/node_filter" }
diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml
index c028f8e6b05..0ffb7034a35 100644
--- a/ethcore/Cargo.toml
+++ b/ethcore/Cargo.toml
@@ -23,7 +23,7 @@ patricia-trie = { path = "../util/patricia_trie" }
 ethcore-io = { path = "../util/io" }
 ethcore-logger = { path = "../logger" }
 ethcore-miner = { path = "../miner" }
-ethcore-stratum = { path = "../stratum" }
+ethcore-stratum = { path = "./stratum" }
 ethcore-transaction = { path = "./transaction" }
 ethereum-types = "0.3"
 memory-cache = { path = "../util/memory_cache" }
diff --git a/stratum/Cargo.toml b/ethcore/stratum/Cargo.toml
similarity index 83%
rename from stratum/Cargo.toml
rename to ethcore/stratum/Cargo.toml
index 5f66cfd49c8..de65a470c66 100644
--- a/stratum/Cargo.toml
+++ b/ethcore/stratum/Cargo.toml
@@ -6,9 +6,8 @@ license = "GPL-3.0"
 authors = ["Parity Technologies <admin@parity.io>"]
 
 [dependencies]
-ethcore-logger = { path = "../logger" }
 ethereum-types = "0.3"
-keccak-hash = { path = "../util/hash" }
+keccak-hash = { path = "../../util/hash" }
 jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.11" }
 jsonrpc-macros = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.11" }
 jsonrpc-tcp-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.11" }
@@ -19,4 +18,4 @@ parking_lot = "0.5"
 env_logger = "0.4"
 tokio-core = "0.1"
 tokio-io = "0.1"
-ethcore-logger = { path = "../logger" }
+ethcore-logger = { path = "../../logger" }
diff --git a/stratum/src/lib.rs b/ethcore/stratum/src/lib.rs
similarity index 96%
rename from stratum/src/lib.rs
rename to ethcore/stratum/src/lib.rs
index d43bcc5569e..a4abeffd73e 100644
--- a/stratum/src/lib.rs
+++ b/ethcore/stratum/src/lib.rs
@@ -77,10 +77,10 @@ impl Stratum {
 	) -> Result<Arc<Stratum>, Error> {
 
 		let implementation = Arc::new(StratumImpl {
-			subscribers: RwLock::new(Vec::new()),
-			job_que: RwLock::new(HashSet::new()),
+			subscribers: RwLock::default(),
+			job_que: RwLock::default(),
 			dispatcher,
-			workers: Arc::new(RwLock::new(HashMap::new())),
+			workers: Arc::new(RwLock::default()),
 			secret,
 			notify_counter: RwLock::new(NOTIFY_COUNTER_INITIAL),
 		});
@@ -323,7 +323,6 @@ impl MetaExtractor<SocketMetadata> for PeerMetaExtractor {
 #[cfg(test)]
 mod tests {
 	use super::*;
-	use std::str::FromStr;
 	use std::net::SocketAddr;
 	use std::sync::Arc;
 
@@ -366,7 +365,7 @@ mod tests {
 
 	#[test]
 	fn can_be_started() {
-		let stratum = Stratum::start(&SocketAddr::from_str("127.0.0.1:19980").unwrap(), Arc::new(VoidManager), None);
+		let stratum = Stratum::start(&"127.0.0.1:19980".parse().unwrap(), Arc::new(VoidManager), None);
 		assert!(stratum.is_ok());
 	}
 
@@ -374,7 +373,7 @@ mod tests {
 	fn records_subscriber() {
 		init_log();
 
-		let addr = SocketAddr::from_str("127.0.0.1:19985").unwrap();
+		let addr = "127.0.0.1:19985".parse().unwrap();
 		let stratum = Stratum::start(&addr, Arc::new(VoidManager), None).unwrap();
 		let request = r#"{"jsonrpc": "2.0", "method": "mining.subscribe", "params": [], "id": 1}"#;
 		dummy_request(&addr, request);
@@ -419,7 +418,7 @@ mod tests {
 
 	#[test]
 	fn receives_initial_paylaod() {
-		let addr = SocketAddr::from_str("127.0.0.1:19975").unwrap();
+		let addr = "127.0.0.1:19975".parse().unwrap();
 		let _stratum = Stratum::start(&addr, DummyManager::new(), None).expect("There should be no error starting stratum");
 		let request = r#"{"jsonrpc": "2.0", "method": "mining.subscribe", "params": [], "id": 2}"#;
 
@@ -430,7 +429,7 @@ mod tests {
 
 	#[test]
 	fn can_authorize() {
-		let addr = SocketAddr::from_str("127.0.0.1:19970").unwrap();
+		let addr = "127.0.0.1:19970".parse().unwrap();
 		let stratum = Stratum::start(
 			&addr,
 			Arc::new(DummyManager::build().of_initial(r#"["dummy autorize payload"]"#)),
@@ -448,7 +447,7 @@ mod tests {
 	fn can_push_work() {
 		init_log();
 
-		let addr = SocketAddr::from_str("127.0.0.1:19995").unwrap();
+		let addr = "127.0.0.1:19995".parse().unwrap();
 		let stratum = Stratum::start(
 			&addr,
 			Arc::new(DummyManager::build().of_initial(r#"["dummy autorize payload"]"#)),
diff --git a/stratum/src/traits.rs b/ethcore/stratum/src/traits.rs
similarity index 100%
rename from stratum/src/traits.rs
rename to ethcore/stratum/src/traits.rs