treat negatives like zero instead of crashing out (#3899)

This commit is contained in:
Rob Walker 2019-04-19 15:46:39 -07:00 committed by GitHub
parent c3155a6e39
commit 85554087d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -221,13 +221,14 @@ fn sample_tx_count<T: Client>(
let log_prefix = format!("{:21}:", client.transactions_addr());
loop {
let tx_count = client.get_transaction_count().expect("transaction count");
assert!(
tx_count >= initial_tx_count,
"expected tx_count({}) >= initial_tx_count({})",
tx_count,
initial_tx_count
);
let mut tx_count = client.get_transaction_count().expect("transaction count");
if tx_count < initial_tx_count {
println!(
"expected tx_count({}) >= initial_tx_count({})",
tx_count, initial_tx_count
);
tx_count = initial_tx_count;
}
let duration = now.elapsed();
now = Instant::now();
let sample = tx_count - initial_tx_count;