Skip to content

Commit

Permalink
cli::test_utils: Remove allow(clippy::arithmetic_side_effects) (sol…
Browse files Browse the repository at this point in the history
ilya-bobyr authored Apr 19, 2024

Verified

This commit was signed with the committer’s verified signature.
danielschemmel Daniel Schemmel
1 parent 201a739 commit 6aacbf3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions cli/src/test_utils.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::arithmetic_side_effects)]

use {
solana_rpc_client::rpc_client::RpcClient,
solana_sdk::{
@@ -46,15 +44,15 @@ pub fn wait_n_slots(rpc_client: &RpcClient, n: u64) -> u64 {
loop {
sleep(Duration::from_millis(DEFAULT_MS_PER_SLOT));
let new_slot = rpc_client.get_slot().unwrap();
if new_slot - slot > n {
if new_slot.saturating_sub(slot) > n {
return new_slot;
}
}
}

pub fn wait_for_next_epoch_plus_n_slots(rpc_client: &RpcClient, n: u64) -> (Epoch, u64) {
let current_epoch = rpc_client.get_epoch_info().unwrap().epoch;
let next_epoch = current_epoch + 1;
let next_epoch = current_epoch.saturating_add(1);
println!("waiting for epoch {next_epoch} plus {n} slots");
loop {
sleep(Duration::from_millis(DEFAULT_MS_PER_SLOT));

0 comments on commit 6aacbf3

Please sign in to comment.