Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::{net::IpAddr, str::FromStr};

#[derive(Debug, Parser)]
#[clap(about, version, author)]
#[clap(group(ArgGroup::new("throttle_group").args(&["throttle", "throttle_microseconds"])))]
#[clap(group(ArgGroup::new("required")))]
pub struct Opt {
#[clap(short, long, display_order = 3)]
Expand Down Expand Up @@ -41,7 +42,10 @@ pub struct Opt {
#[clap(long = "throttle", display_order = 9)]
/// Throttle (milliseconds) between each pow hash generation (used for development testing)
pub throttle: Option<u64>,
#[clap(long, display_order = 10)]
#[clap(long = "throttle-microseconds", display_order = 10)]
/// Throttle (microseconds) between each pow hash generation (used for development testing)
pub throttle_microseconds: Option<u64>,
#[clap(long, display_order = 11)]
/// Output logs in alternative format (same as kaspad)
pub altlogs: bool,
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async fn main() -> Result<(), Error> {
}
builder.init();

let throttle = opt.throttle.map(Duration::from_millis);
let throttle = opt.throttle.map(Duration::from_millis).or_else(|| opt.throttle_microseconds.map(Duration::from_micros));
let shutdown = ShutdownHandler(Arc::new(AtomicBool::new(false)));
let _shutdown_when_dropped = shutdown.arm();

Expand Down