Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 0a26dd1

Browse files
committed
PR comments
1 parent 9cba5b2 commit 0a26dd1

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

local-cluster/tests/common/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,20 @@ pub fn restore_tower(tower_path: &Path, node_pubkey: &Pubkey) -> Option<Tower> {
7777
Tower::restore(&file_tower_storage, node_pubkey).ok()
7878
}
7979

80-
pub fn remove_tower(tower_path: &Path, node_pubkey: &Pubkey) {
80+
pub fn remove_tower_if_exists(tower_path: &Path, node_pubkey: &Pubkey) {
8181
let file_tower_storage = FileTowerStorage::new(tower_path.to_path_buf());
8282
let filename = file_tower_storage.filename(node_pubkey);
8383
if filename.exists() {
8484
fs::remove_file(file_tower_storage.filename(node_pubkey)).unwrap();
8585
}
8686
}
8787

88+
pub fn remove_tower(tower_path: &Path, node_pubkey: &Pubkey) {
89+
let file_tower_storage = FileTowerStorage::new(tower_path.to_path_buf());
90+
let filename = file_tower_storage.filename(node_pubkey);
91+
fs::remove_file(file_tower_storage.filename(node_pubkey)).unwrap();
92+
}
93+
8894
pub fn open_blockstore(ledger_path: &Path) -> Blockstore {
8995
Blockstore::open_with_options(
9096
ledger_path,

local-cluster/tests/local_cluster.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5069,7 +5069,7 @@ fn test_duplicate_shreds_switch_failure() {
50695069
}
50705070

50715071
fn clear_ledger_and_tower(ledger_path: &Path, pubkey: &Pubkey, start_slot: Slot) {
5072-
remove_tower(ledger_path, pubkey);
5072+
remove_tower_if_exists(ledger_path, pubkey);
50735073
let blockstore = open_blockstore(ledger_path);
50745074
purge_slots_with_count(&blockstore, start_slot, 1000);
50755075
{
@@ -5169,7 +5169,7 @@ fn test_duplicate_shreds_switch_failure() {
51695169
// 1) Two nodes that sum to > DUPLICATE_THRESHOLD but < 2/3+ supermajority. It's important both
51705170
// of them individually have <= DUPLICATE_THRESHOLD to avoid duplicate confirming their own blocks
51715171
// immediately upon voting
5172-
// 2) One with < SWITCHING_THRESHOLD so that validator from 1) can't switch to it
5172+
// 2) One with <= SWITCHING_THRESHOLD so that validator from 1) can't switch to it
51735173
// 3) One bad leader to make duplicate slots
51745174
let total_stake = 100 * DEFAULT_NODE_STAKE;
51755175
let target_switch_fork_stake = (total_stake as f64 * SWITCH_FORK_THRESHOLD) as u64;

turbine/src/broadcast_stage/broadcast_duplicates_run.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,6 @@ impl BroadcastRun for BroadcastDuplicatesRun {
218218
bank.slot(),
219219
sigs,
220220
);
221-
if let Some(duplicate_slot_sender) = &self.config.duplicate_slot_sender {
222-
let _ = duplicate_slot_sender.send(bank.slot());
223-
}
224221

225222
self.next_shred_index += 1;
226223
(original_last_data_shred, partition_last_data_shred)
@@ -267,6 +264,9 @@ impl BroadcastRun for BroadcastDuplicatesRun {
267264
.iter()
268265
.all(|shred| shred.slot() == bank.slot()));
269266

267+
if let Some(duplicate_slot_sender) = &self.config.duplicate_slot_sender {
268+
let _ = duplicate_slot_sender.send(bank.slot());
269+
}
270270
socket_sender.send((original_last_data_shred, None))?;
271271
socket_sender.send((partition_last_data_shred, None))?;
272272
}

0 commit comments

Comments
 (0)