From 563ac12b078e3e82b360f2af34abd3bdaa02c455 Mon Sep 17 00:00:00 2001 From: "Bernardo A. Rodrigues" Date: Mon, 1 Mar 2021 17:16:46 -0300 Subject: [PATCH] remote_pow --- Cargo.toml | 2 +- README.md | 18 +++++++++--------- src/main.rs | 14 +++++++------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e58c15e..fa19b87 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota_rspammer" -version = "0.1.0" +version = "0.1.1" authors = ["Bernardo A. Rodrigues "] edition = "2018" diff --git a/README.md b/README.md index 0c97091..cb6fc32 100644 --- a/README.md +++ b/README.md @@ -29,22 +29,22 @@ $ cargo build ## Run ``` $ cargo run -- -h -iota_rspammer 0.1.0 +iota_rspammer 0.1.1 USAGE: iota_rspammer [FLAGS] [OPTIONS] FLAGS: - -h, --help Prints help information - -l, --local_pow Enable local_pow - -V, --version Prints version information + -h, --help Prints help information + -r, --remote_pow force remote_pow + -V, --version Prints version information OPTIONS: - -i, --index Message index [default: iota_rspammer] - -m, --msg_size Message Size (bytes) [default: 10] - -n, --n_threads Number of Spammer Threads [default: 1] - -t, --timeout Set Timeout (seconds) [default: 500] - -u, --url Node URL [default: http://api.hornet-1.testnet.chrysalis2.com] + -i, --index Message index [default: iota_rspammer] + -m, --msg_size Message Size (bytes) [default: 10] + -n, --n_threads Number of Spammer Threads [default: 1] + -t, --timeout Set Timeout (seconds) [default: 500] + -u, --url Node URL [default: http://api.hornet-1.testnet.chrysalis2.com] ``` ``` diff --git a/src/main.rs b/src/main.rs index 07d64d9..09972e0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,9 +44,9 @@ struct Opt { #[structopt(short = "n", long = "n_threads", default_value = "1")] n_threads: u32, - /// Enable local_pow - #[structopt(short = "l", long = "local_pow", default_value = "true")] - local_pow: bool, + /// Force remote_pow + #[structopt(short = "r", long = "remote_pow")] + remote_pow: bool, /// Set Timeout (seconds) #[structopt(short = "t", long = "timeout", default_value = "500")] @@ -68,7 +68,7 @@ async fn main() { let index = opt.index; let url = opt.url; let n_threads = opt.n_threads; - let local_pow = opt.local_pow; + let remote_pow = opt.remote_pow; let msg_size = parse_msg_size(msg_size_str); @@ -76,7 +76,7 @@ async fn main() { println!("message payload size: {} bytes", msg_size); println!("message index: {}", index); println!("node url: {}", url.as_str()); - println!("local PoW: {}\n", local_pow); + println!("remote PoW: {}\n", remote_pow); let (tx, mut rx): ( mpsc::UnboundedSender, @@ -87,13 +87,13 @@ async fn main() { let thread_tx = tx.clone(); let thread_n = n.clone(); let thread_index = index.clone(); - let thread_local_pow = local_pow.clone(); + let thread_remote_pow = remote_pow.clone(); tokio::spawn(async move { let iota = Client::builder() // Crate a client instance builder .with_node(thread_url.as_str()) // Insert the node here .unwrap() - .with_local_pow(thread_local_pow) + .with_local_pow(!thread_remote_pow) //.with_request_timeout(Duration::new(500, 0)) .with_api_timeout(Api::PostMessageWithRemotePow, Duration::new(500, 0)) .finish()