From 128226c6ccbd1071702e5140f01b3ce21011d722 Mon Sep 17 00:00:00 2001 From: behzad nouri Date: Mon, 11 Jul 2022 12:56:31 +0000 Subject: [PATCH] patches flaky test_push_votes_with_tower (#26554) cargo test --package solana-gossip --release test_push_votes_with_tower occasionally fails because with --release all votes are generated at the same wallclock (milliseconds resolution) and so the new ones will not necessarily override existing entries in the table. The commit ensures that the new vote is pushed with a wallclock later than existing entries. --- gossip/src/cluster_info.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gossip/src/cluster_info.rs b/gossip/src/cluster_info.rs index 4bbde3f4b3..4994a82309 100644 --- a/gossip/src/cluster_info.rs +++ b/gossip/src/cluster_info.rs @@ -3874,6 +3874,9 @@ RPC Enabled Nodes: 1"#; tower.push(slot); tower.remove(23); let vote = new_vote_transaction(&mut rng, vec![slot]); + // New versioned-crds-value should have wallclock later than existing + // entries, otherwise might not get inserted into the table. + sleep(Duration::from_millis(5)); cluster_info.push_vote(&tower, vote); let vote_slots = get_vote_slots(&cluster_info); assert_eq!(vote_slots.len(), MAX_LOCKOUT_HISTORY);