legacy repair type cleanup (#32849)
This commit is contained in:
parent
be6d6fa5ae
commit
13b7ae1432
|
@ -101,9 +101,9 @@ pub enum ShredRepairType {
|
||||||
impl ShredRepairType {
|
impl ShredRepairType {
|
||||||
pub fn slot(&self) -> Slot {
|
pub fn slot(&self) -> Slot {
|
||||||
match self {
|
match self {
|
||||||
ShredRepairType::Orphan(slot) => *slot,
|
ShredRepairType::Orphan(slot)
|
||||||
ShredRepairType::HighestShred(slot, _) => *slot,
|
| ShredRepairType::HighestShred(slot, _)
|
||||||
ShredRepairType::Shred(slot, _) => *slot,
|
| ShredRepairType::Shred(slot, _) => *slot,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,9 +112,8 @@ impl RequestResponse for ShredRepairType {
|
||||||
type Response = Shred;
|
type Response = Shred;
|
||||||
fn num_expected_responses(&self) -> u32 {
|
fn num_expected_responses(&self) -> u32 {
|
||||||
match self {
|
match self {
|
||||||
ShredRepairType::Orphan(_) => (MAX_ORPHAN_REPAIR_RESPONSES) as u32,
|
ShredRepairType::Orphan(_) => MAX_ORPHAN_REPAIR_RESPONSES as u32,
|
||||||
ShredRepairType::HighestShred(_, _) => 1,
|
ShredRepairType::Shred(_, _) | ShredRepairType::HighestShred(_, _) => 1,
|
||||||
ShredRepairType::Shred(_, _) => 1,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn verify_response(&self, response_shred: &Shred) -> bool {
|
fn verify_response(&self, response_shred: &Shred) -> bool {
|
||||||
|
@ -307,18 +306,17 @@ impl RepairProtocol {
|
||||||
fn max_response_packets(&self) -> usize {
|
fn max_response_packets(&self) -> usize {
|
||||||
match self {
|
match self {
|
||||||
RepairProtocol::WindowIndex { .. }
|
RepairProtocol::WindowIndex { .. }
|
||||||
| RepairProtocol::LegacyWindowIndexWithNonce(_, _, _, _)
|
|
||||||
| RepairProtocol::HighestWindowIndex { .. }
|
| RepairProtocol::HighestWindowIndex { .. }
|
||||||
| RepairProtocol::LegacyHighestWindowIndexWithNonce(_, _, _, _)
|
| RepairProtocol::AncestorHashes { .. } => 1,
|
||||||
| RepairProtocol::AncestorHashes { .. }
|
RepairProtocol::Orphan { .. } => MAX_ORPHAN_REPAIR_RESPONSES,
|
||||||
| RepairProtocol::LegacyAncestorHashes(_, _, _) => 1,
|
|
||||||
RepairProtocol::Orphan { .. } | RepairProtocol::LegacyOrphanWithNonce(_, _, _) => {
|
|
||||||
MAX_ORPHAN_REPAIR_RESPONSES
|
|
||||||
}
|
|
||||||
RepairProtocol::Pong(_) => 0, // no response
|
RepairProtocol::Pong(_) => 0, // no response
|
||||||
RepairProtocol::LegacyWindowIndex(_, _, _)
|
RepairProtocol::LegacyWindowIndex(_, _, _)
|
||||||
| RepairProtocol::LegacyHighestWindowIndex(_, _, _)
|
| RepairProtocol::LegacyHighestWindowIndex(_, _, _)
|
||||||
| RepairProtocol::LegacyOrphan(_, _) => 0, // unsupported
|
| RepairProtocol::LegacyOrphan(_, _)
|
||||||
|
| RepairProtocol::LegacyWindowIndexWithNonce(_, _, _, _)
|
||||||
|
| RepairProtocol::LegacyHighestWindowIndexWithNonce(_, _, _, _)
|
||||||
|
| RepairProtocol::LegacyOrphanWithNonce(_, _, _)
|
||||||
|
| RepairProtocol::LegacyAncestorHashes(_, _, _) => 0, // unsupported
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2295,9 +2293,9 @@ mod tests {
|
||||||
let repair = ShredRepairType::Orphan(9);
|
let repair = ShredRepairType::Orphan(9);
|
||||||
// Ensure new options are addded to this test
|
// Ensure new options are addded to this test
|
||||||
match repair {
|
match repair {
|
||||||
ShredRepairType::Orphan(_) => (),
|
ShredRepairType::Orphan(_)
|
||||||
ShredRepairType::HighestShred(_, _) => (),
|
| ShredRepairType::HighestShred(_, _)
|
||||||
ShredRepairType::Shred(_, _) => (),
|
| ShredRepairType::Shred(_, _) => (),
|
||||||
};
|
};
|
||||||
|
|
||||||
let slot = 9;
|
let slot = 9;
|
||||||
|
|
Loading…
Reference in New Issue