fix so that we don't hit end of epoch - leader not found before trying to transfer
This commit is contained in:
@ -119,21 +119,21 @@ pub fn verify_ledger_ticks(ledger_path: &str, ticks_per_slot: usize) {
|
||||
}
|
||||
|
||||
pub fn sleep_n_epochs(
|
||||
num_epochs: u64,
|
||||
num_epochs: f64,
|
||||
config: &PohServiceConfig,
|
||||
ticks_per_slot: u64,
|
||||
slots_per_epoch: u64,
|
||||
) {
|
||||
let num_ticks_per_second = {
|
||||
match config {
|
||||
PohServiceConfig::Sleep(d) => (1000 / d.as_millis()) as u64,
|
||||
PohServiceConfig::Sleep(d) => (1000 / d.as_millis()) as f64,
|
||||
_ => panic!("Unsuppported tick config for testing"),
|
||||
}
|
||||
};
|
||||
|
||||
let num_ticks_to_sleep = num_epochs * ticks_per_slot * slots_per_epoch;
|
||||
let num_ticks_to_sleep = num_epochs * ticks_per_slot as f64 * slots_per_epoch as f64;
|
||||
sleep(Duration::from_secs(
|
||||
(num_ticks_to_sleep + num_ticks_per_second - 1) / num_ticks_per_second,
|
||||
((num_ticks_to_sleep + num_ticks_per_second - 1.0) / num_ticks_per_second) as u64,
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ fn test_two_unbalanced_stakes() {
|
||||
num_slots_per_epoch,
|
||||
);
|
||||
cluster_tests::sleep_n_epochs(
|
||||
10,
|
||||
10.0,
|
||||
&fullnode_config.tick_config,
|
||||
num_ticks_per_slot,
|
||||
num_slots_per_epoch,
|
||||
@ -154,14 +154,14 @@ fn test_restart_node() {
|
||||
);
|
||||
let nodes = cluster.get_node_ids();
|
||||
cluster_tests::sleep_n_epochs(
|
||||
1,
|
||||
1.0,
|
||||
&fullnode_config.tick_config,
|
||||
timing::DEFAULT_TICKS_PER_SLOT,
|
||||
slots_per_epoch,
|
||||
);
|
||||
cluster.restart_node(nodes[0]);
|
||||
cluster_tests::sleep_n_epochs(
|
||||
1,
|
||||
0.5,
|
||||
&fullnode_config.tick_config,
|
||||
timing::DEFAULT_TICKS_PER_SLOT,
|
||||
slots_per_epoch,
|
||||
|
Reference in New Issue
Block a user