From b53aa500fea005c9532477b3c64ff57c519b9157 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Thu, 17 Mar 2022 14:47:30 +0100 Subject: [PATCH] chore: decrease tx count in nonce manager test (#1053) --- ethers-middleware/tests/nonce_manager.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ethers-middleware/tests/nonce_manager.rs b/ethers-middleware/tests/nonce_manager.rs index 5e0a23dc..63331037 100644 --- a/ethers-middleware/tests/nonce_manager.rs +++ b/ethers-middleware/tests/nonce_manager.rs @@ -30,8 +30,9 @@ async fn nonce_manager() { .unwrap() .as_u64(); - let mut tx_hashes = Vec::new(); - for _ in 0..10 { + let num_tx = 5; + let mut tx_hashes = Vec::with_capacity(num_tx); + for _ in 0..num_tx { let tx = provider .send_transaction( Eip1559TransactionRequest::new().to(address).value(100u64).chain_id(chain_id), @@ -45,10 +46,10 @@ async fn nonce_manager() { // sleep a bit to ensure there's no flakiness in the test std::thread::sleep(std::time::Duration::new(3, 0)); - let mut nonces = Vec::new(); + let mut nonces = Vec::with_capacity(num_tx); for tx_hash in tx_hashes { nonces.push(provider.get_transaction(tx_hash).await.unwrap().unwrap().nonce.as_u64()); } - assert_eq!(nonces, (nonce..nonce + 10).collect::>()) + assert_eq!(nonces, (nonce..nonce + (num_tx as u64)).collect::>()) }