fn check_chunk(
    slot: Slot,
    shred_index: u32,
    shred_type: ShredType,
    num_chunks: u8,
) -> impl Fn(&DuplicateShred) -> Result<(), Error> {
    move |dup| {
        if dup.slot != slot {
            Err(Error::SlotMismatch)
        } else if dup.shred_index != shred_index {
            Err(Error::ShredIndexMismatch)
        } else if dup.shred_type != shred_type {
            Err(Error::ShredTypeMismatch)
        } else if dup.num_chunks != num_chunks {
            Err(Error::NumChunksMismatch)
        } else if dup.chunk_index >= num_chunks {
            Err(Error::InvalidChunkIndex)
        } else {
            Ok(())
        }
    }
}
// Returns a predicate checking if a duplicate-shred chunk matches
// (slot, shred_index, shred_type) and has valid chunk_index.
Returns a predicate checking if a duplicate-shred chunk matches
(slot, shred_index, shred_type) and has valid chunk_index.
Returns a predicate checking if a duplicate - shred chunk matches ( slot shred_index shred_type ) and has valid chunk_index .
fn check_chunk(
    slot: Slot,
    shred_index: u32,
    shred_type: ShredType,
    num_chunks: u8,
) -> impl Fn(&DuplicateShred) -> Result<(), Error> {
    move |dup| {
        if dup.slot != slot {
            Err(Error::SlotMismatch)
        } else if dup.shred_index != shred_index {
            Err(Error::ShredIndexMismatch)
        } else if dup.shred_type != shred_type {
            Err(Error::ShredTypeMismatch)
        } else if dup.num_chunks != num_chunks {
            Err(Error::NumChunksMismatch)
        } else if dup.chunk_index >= num_chunks {
            Err(Error::InvalidChunkIndex)
        } else {
            Ok(())
        }
    }
}
fn check_chunk ( slot : Slot , shred_index : u32 , shred_type : ShredType , num_chunks : u8 , ) -> impl Fn ( & DuplicateShred ) -> Result < ( ) , Error > { move | dup | { if dup . slot != slot { Err ( Error :: SlotMismatch ) } else if dup . shred_index != shred_index { Err ( Error :: ShredIndexMismatch ) } else if dup . shred_type != shred_type { Err ( Error :: ShredTypeMismatch ) } else if dup . num_chunks != num_chunks { Err ( Error :: NumChunksMismatch ) } else if dup . chunk_index >= num_chunks { Err ( Error :: InvalidChunkIndex ) } else { Ok ( ( ) ) } } }
Returns a predicate checking if a duplicate-shred chunk matches
(slot, shred_index, shred_type) and has valid chunk_index.
Returns a predicate checking if a duplicate - shred chunk matches ( slot shred_index shred_type ) and has valid chunk_index .
slot
Slot
shred_index
u32
shred_type
ShredType
num_chunks
u8