fn run_highest_window_request(slot: Slot, num_slots: u64, nonce: Nonce) {
        let recycler = PacketBatchRecycler::default();
        solana_logger::setup();
        let ledger_path = get_tmp_ledger_path!();
        {
            let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
            let rv = ServeRepair::run_highest_window_request(
                &recycler,
                &socketaddr_any!(),
                Some(&blockstore),
                0,
                0,
                nonce,
            );
            assert!(rv.is_none());

            let _ = fill_blockstore_slot_with_ticks(
                &blockstore,
                max_ticks_per_n_shreds(1, None) + 1,
                slot,
                slot - num_slots + 1,
                Hash::default(),
            );

            let index = 1;
            let rv = ServeRepair::run_highest_window_request(
                &recycler,
                &socketaddr_any!(),
                Some(&blockstore),
                slot,
                index,
                nonce,
            )
            .expect("packets");
            let request = ShredRepairType::HighestShred(slot, index);
            verify_responses(&request, rv.packets.iter());

            let rv: Vec<Shred> = rv
                .packets
                .into_iter()
                .filter_map(|b| {
                    assert_eq!(repair_response::nonce(&b.data[..]).unwrap(), nonce);
                    Shred::new_from_serialized_shred(b.data.to_vec()).ok()
                })
                .collect();
            assert!(!rv.is_empty());
            let index = blockstore.meta(slot).unwrap().unwrap().received - 1;
            assert_eq!(rv[0].index(), index as u32);
            assert_eq!(rv[0].slot(), slot);

            let rv = ServeRepair::run_highest_window_request(
                &recycler,
                &socketaddr_any!(),
                Some(&blockstore),
                slot,
                index + 1,
                nonce,
            );
            assert!(rv.is_none());
        }

        Blockstore::destroy(&ledger_path).expect("Expected successful database destruction");
    }
/// test run_window_request responds with the right shred, and do not overrun
test run_window_request responds with the right shred, and do not overrun
test run_window_request responds with the right shred and do not overrun
fn run_highest_window_request(slot: Slot, num_slots: u64, nonce: Nonce) {
        let recycler = PacketBatchRecycler::default();
        solana_logger::setup();
        let ledger_path = get_tmp_ledger_path!();
        {
            let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
            let rv = ServeRepair::run_highest_window_request(
                &recycler,
                &socketaddr_any!(),
                Some(&blockstore),
                0,
                0,
                nonce,
            );
            assert!(rv.is_none());
            let _ = fill_blockstore_slot_with_ticks(
                &blockstore,
                max_ticks_per_n_shreds(1, None) + 1,
                slot,
                slot - num_slots + 1,
                Hash::default(),
            );
            let index = 1;
            let rv = ServeRepair::run_highest_window_request(
                &recycler,
                &socketaddr_any!(),
                Some(&blockstore),
                slot,
                index,
                nonce,
            )
            .expect("packets");
            let request = ShredRepairType::HighestShred(slot, index);
            verify_responses(&request, rv.packets.iter());
            let rv: Vec<Shred> = rv
                .packets
                .into_iter()
                .filter_map(|b| {
                    assert_eq!(repair_response::nonce(&b.data[..]).unwrap(), nonce);
                    Shred::new_from_serialized_shred(b.data.to_vec()).ok()
                })
                .collect();
            assert!(!rv.is_empty());
            let index = blockstore.meta(slot).unwrap().unwrap().received - 1;
            assert_eq!(rv[0].index(), index as u32);
            assert_eq!(rv[0].slot(), slot);
            let rv = ServeRepair::run_highest_window_request(
                &recycler,
                &socketaddr_any!(),
                Some(&blockstore),
                slot,
                index + 1,
                nonce,
            );
            assert!(rv.is_none());
        }
        Blockstore::destroy(&ledger_path).expect("Expected successful database destruction");
    }
fn run_highest_window_request ( slot : Slot , num_slots : u64 , nonce : Nonce ) { let recycler = PacketBatchRecycler :: default ( ) ; solana_logger :: setup ( ) ; let ledger_path = get_tmp_ledger_path ! ( ) ; { let blockstore = Arc :: new ( Blockstore :: open ( & ledger_path ) . unwrap ( ) ) ; let rv = ServeRepair :: run_highest_window_request ( & recycler , & socketaddr_any ! ( ) , Some ( & blockstore ) , 0 , 0 , nonce , ) ; assert ! ( rv is_none ( ) ) ; let _ = fill_blockstore_slot_with_ticks ( & blockstore , max_ticks_per_n_shreds ( 1 , None ) + 1 , slot , slot - num_slots + 1 , Hash :: default ( ) , ) ; let index = 1 ; let rv = ServeRepair :: run_highest_window_request ( & recycler , & socketaddr_any ! ( ) , Some ( & blockstore ) , slot , index , nonce , ) . expect ( " " ) ; let request = ShredRepairType :: HighestShred ( slot , index ) ; verify_responses ( & request , rv . packets . iter ( ) ) ; let rv : Vec < Shred > = rv . packets . into_iter ( ) . filter_map ( | b | { assert_eq ! ( repair_response nonce ( b data [ ] ) unwrap ( ) nonce ) ; Shred :: new_from_serialized_shred ( b . data . to_vec ( ) ) . ok ( ) } ) . collect ( ) ; assert ! ( rv is_empty ( ) ) ; let index = blockstore . meta ( slot ) . unwrap ( ) . unwrap ( ) . received - 1 ; assert_eq ! ( rv [ 0 ] index ( ) index as u32 ) ; assert_eq ! ( rv [ 0 ] slot ( ) slot ) ; let rv = ServeRepair :: run_highest_window_request ( & recycler , & socketaddr_any ! ( ) , Some ( & blockstore ) , slot , index + 1 , nonce , ) ; assert ! ( rv is_none ( ) ) ; } Blockstore :: destroy ( & ledger_path ) . expect ( " " ) ; }
test run_window_request responds with the right shred, and do not overrun
test run_window_request responds with the right shred and do not overrun
slot
Slot
num_slots
u64
nonce
Nonce