Skip to content

Commit

Permalink
Merge pull request #8 from bernardoaraujor/dev
Browse files Browse the repository at this point in the history
remote_pow: v0.1.1
  • Loading branch information
bernardoaraujor authored Mar 1, 2021
2 parents 34ed334 + 563ac12 commit 5b59e6b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "iota_rspammer"
version = "0.1.0"
version = "0.1.1"
authors = ["Bernardo A. Rodrigues <[email protected]>"]
edition = "2018"

Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <index> Message index [default: iota_rspammer]
-m, --msg_size <msg> Message Size (bytes) [default: 10]
-n, --n_threads <n-threads> Number of Spammer Threads [default: 1]
-t, --timeout <timeout> Set Timeout (seconds) [default: 500]
-u, --url <url> Node URL [default: http://api.hornet-1.testnet.chrysalis2.com]
-i, --index <index> Message index [default: iota_rspammer]
-m, --msg_size <msg> Message Size (bytes) [default: 10]
-n, --n_threads <n-threads> Number of Spammer Threads [default: 1]
-t, --timeout <timeout> Set Timeout (seconds) [default: 500]
-u, --url <url> Node URL [default: http://api.hornet-1.testnet.chrysalis2.com]
```

```
Expand Down
14 changes: 7 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -68,15 +68,15 @@ 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);

println!("Starting iota_rspammer with the following parameters:");
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<MsgResult>,
Expand All @@ -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()
Expand Down

0 comments on commit 5b59e6b

Please sign in to comment.