diff --git a/README.md b/README.md index 505bd40..f8276ae 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Options: --num-blocks Number of blocks to test from the tip [default: 32] --use-reth Whether to query reth namespace --use-tracing Whether to query tracing methods - --use-all-txes Whether to query every transacion from a block or just the first + --use-all-txes Whether to query every transaction from a block or just the first --rate-limit Maximum requests per second (rate limit) --timeout Maximum time to wait for syncing in seconds [default: 300] -h, --help Print help diff --git a/crates/rpc-tester-cli/src/main.rs b/crates/rpc-tester-cli/src/main.rs index 194e07f..574d7f8 100644 --- a/crates/rpc-tester-cli/src/main.rs +++ b/crates/rpc-tester-cli/src/main.rs @@ -35,7 +35,7 @@ pub struct CliArgs { #[arg(long, value_name = "TRACING", default_value = "false")] pub use_tracing: bool, - /// Whether to query every transacion from a block or just the first. + /// Whether to query every transaction from a block or just the first. #[arg(long, value_name = "ALL_TXES", default_value = "false")] pub use_all_txes: bool, @@ -69,7 +69,9 @@ async fn main() -> eyre::Result<()> { .network::() .on_http(args.rpc2); - let block_range = wait_for_readiness(&rpc1, &rpc2, args.num_blocks).await?; + let timeout = Duration::from_secs(args.timeout); + + let block_range = wait_for_readiness(&rpc1, &rpc2, args.num_blocks, timeout).await?; RpcTester::builder(rpc1, rpc2) .with_tracing(args.use_tracing) @@ -87,17 +89,16 @@ pub async fn wait_for_readiness>( rpc1: &P, rpc2: &P, block_size_range: u64, + timeout: Duration, ) -> eyre::Result> { - let args = CliArgs::parse(); let start_time = Instant::now(); - let timeout = Duration::from_secs(args.timeout); // Waits until it's done syncing while let SyncStatus::Info(sync_info) = rpc1.syncing().await? { if start_time.elapsed() > timeout { return Err(eyre::eyre!( "Timeout waiting for rpc1 to sync after {} seconds", - args.timeout + timeout.as_secs() )); } info!(?sync_info, "rpc1 still syncing");