Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bw-solana committed Jan 16, 2025
1 parent 334abba commit 4b73cae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 20 deletions.
2 changes: 1 addition & 1 deletion core/src/repair/repair_generic_traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ pub fn get_unknown_last_index(
unknown_last.sort_by(|(_, _, count1), (_, _, count2)| count2.cmp(count1));
unknown_last
.iter()
.take(limit)
.map(|(slot, received, _)| ShredRepairType::HighestShred(*slot, *received))
.filter(|repair_request| {
if !outstanding_repairs.contains_key(repair_request) {
Expand All @@ -85,6 +84,7 @@ pub fn get_unknown_last_index(
false
}
})
.take(limit)
.collect()
}

Expand Down
23 changes: 5 additions & 18 deletions core/src/repair/repair_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,19 +430,6 @@ impl RepairService {
),
};

// Filter out repair requests that are duplicates and haven't timed out.
let repairs = repairs
.into_iter()
.filter(|repair_request| {
if !outstanding_repairs.contains_key(repair_request) {
outstanding_repairs.insert(*repair_request, timestamp());
true
} else {
false
}
})
.collect::<Vec<_>>();

let mut popular_pruned_forks = repair_weight.get_popular_pruned_forks(
root_bank.epoch_stakes_map(),
root_bank.epoch_schedule(),
Expand Down Expand Up @@ -1225,7 +1212,7 @@ mod test {
MAX_CLOSEST_COMPLETION_REPAIRS,
&mut RepairTiming::default(),
&mut BestRepairsStats::default(),
&mut HashMap::new(),
&mut HashMap::default(),
),
vec![
ShredRepairType::Orphan(2),
Expand Down Expand Up @@ -1258,7 +1245,7 @@ mod test {
MAX_CLOSEST_COMPLETION_REPAIRS,
&mut RepairTiming::default(),
&mut BestRepairsStats::default(),
&mut HashMap::new(),
&mut HashMap::default(),
),
vec![ShredRepairType::HighestShred(0, 0)]
);
Expand Down Expand Up @@ -1316,7 +1303,7 @@ mod test {
MAX_CLOSEST_COMPLETION_REPAIRS,
&mut RepairTiming::default(),
&mut BestRepairsStats::default(),
&mut HashMap::new(),
&mut HashMap::default(),
),
expected
);
Expand All @@ -1332,7 +1319,7 @@ mod test {
MAX_CLOSEST_COMPLETION_REPAIRS,
&mut RepairTiming::default(),
&mut BestRepairsStats::default(),
&mut HashMap::new(),
&mut HashMap::default(),
)[..],
expected[0..expected.len() - 2]
);
Expand Down Expand Up @@ -1376,7 +1363,7 @@ mod test {
MAX_CLOSEST_COMPLETION_REPAIRS,
&mut RepairTiming::default(),
&mut BestRepairsStats::default(),
&mut HashMap::new(),
&mut HashMap::default(),
),
expected
);
Expand Down
2 changes: 1 addition & 1 deletion core/src/repair/repair_weight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,7 @@ mod test {
bank.epoch_stakes_map(),
bank.epoch_schedule(),
1,
&mut outstanding_repairs,
&mut HashMap::default(),
);
assert_eq!(
repair_weight
Expand Down

0 comments on commit 4b73cae

Please sign in to comment.