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

Commit

Permalink
ethcore-stratum crate moved to ethcore directory (#8338)
Browse files Browse the repository at this point in the history
  • Loading branch information
debris authored Apr 10, 2018
1 parent 0d75d01 commit 8e7a08f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
5 changes: 2 additions & 3 deletions stratum/Cargo.toml → ethcore/stratum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ license = "GPL-3.0"
authors = ["Parity Technologies <[email protected]>"]

[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" }
Expand All @@ -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" }
17 changes: 8 additions & 9 deletions stratum/src/lib.rs → ethcore/stratum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -366,15 +365,15 @@ 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());
}

#[test]
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);
Expand Down Expand Up @@ -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}"#;

Expand All @@ -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"]"#)),
Expand All @@ -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"]"#)),
Expand Down
File renamed without changes.

0 comments on commit 8e7a08f

Please sign in to comment.