fn filter_pending_packets_from_pending_txs(
        bank: &Arc<Bank>,
        transactions: &[Transaction],
        transaction_to_packet_indexes: &[usize],
        pending_indexes: &[usize],
    ) -> Vec<usize> {
        let filter = Self::prepare_filter_for_pending_transactions(transactions, pending_indexes);

        let mut error_counters = ErrorCounters::default();
        // The following code also checks if the blockhash for a transaction is too old
        // The check accounts for
        //  1. Transaction forwarding delay
        //  2. The slot at which the next leader will actually process the transaction
        // Drop the transaction if it will expire by the time the next node receives and processes it
        let api = perf_libs::api();
        let max_tx_fwd_delay = if api.is_none() {
            MAX_TRANSACTION_FORWARDING_DELAY
        } else {
            MAX_TRANSACTION_FORWARDING_DELAY_GPU
        };
        let result = bank.check_transactions(
            transactions,
            &filter,
            (MAX_PROCESSING_AGE)
                .saturating_sub(max_tx_fwd_delay)
                .saturating_sub(FORWARD_TRANSACTIONS_TO_LEADER_AT_SLOT_OFFSET as usize),
            &mut error_counters,
        );

        Self::filter_valid_transaction_indexes(&result, transaction_to_packet_indexes)
    }
/// This function filters pending packets that are still valid
/// # Arguments
/// * `transactions` - a batch of transactions deserialized from packets
/// * `transaction_to_packet_indexes` - maps each transaction to a packet index
/// * `pending_indexes` - identifies which indexes in the `transactions` list are still pending
This function filters pending packets that are still valid
This function filters pending packets that are still valid
fn filter_pending_packets_from_pending_txs(
        bank: &Arc<Bank>,
        transactions: &[Transaction],
        transaction_to_packet_indexes: &[usize],
        pending_indexes: &[usize],
    ) -> Vec<usize> {
        let filter = Self::prepare_filter_for_pending_transactions(transactions, pending_indexes);
        let mut error_counters = ErrorCounters::default();
        // The following code also checks if the blockhash for a transaction is too old
        // The check accounts for
        //  1. Transaction forwarding delay
        //  2. The slot at which the next leader will actually process the transaction
        // Drop the transaction if it will expire by the time the next node receives and processes it
        let api = perf_libs::api();
        let max_tx_fwd_delay = if api.is_none() {
            MAX_TRANSACTION_FORWARDING_DELAY
        } else {
            MAX_TRANSACTION_FORWARDING_DELAY_GPU
        };
        let result = bank.check_transactions(
            transactions,
            &filter,
            (MAX_PROCESSING_AGE)
                .saturating_sub(max_tx_fwd_delay)
                .saturating_sub(FORWARD_TRANSACTIONS_TO_LEADER_AT_SLOT_OFFSET as usize),
            &mut error_counters,
        );
        Self::filter_valid_transaction_indexes(&result, transaction_to_packet_indexes)
    }
fn filter_pending_packets_from_pending_txs ( bank : & Arc < Bank > , transactions : & [ Transaction ] , transaction_to_packet_indexes : & [ usize ] , pending_indexes : & [ usize ] , ) -> Vec < usize > { let filter = Self :: prepare_filter_for_pending_transactions ( transactions , pending_indexes ) ; let mut error_counters = ErrorCounters :: default ( ) ; // The following code also checks if the blockhash for a transaction is too old // The check accounts for //  1. Transaction forwarding delay //  2. The slot at which the next leader will actually process the transaction // Drop the transaction if it will expire by the time the next node receives and processes it let api = perf_libs :: api ( ) ; let max_tx_fwd_delay = if api . is_none ( ) { MAX_TRANSACTION_FORWARDING_DELAY } else { MAX_TRANSACTION_FORWARDING_DELAY_GPU } ; let result = bank . check_transactions ( transactions , & filter , ( MAX_PROCESSING_AGE ) . saturating_sub ( max_tx_fwd_delay ) . saturating_sub ( FORWARD_TRANSACTIONS_TO_LEADER_AT_SLOT_OFFSET as usize ) , & mut error_counters , ) ; Self :: filter_valid_transaction_indexes ( & result , transaction_to_packet_indexes ) }
This function filters pending packets that are still valid
This function filters pending packets that are still valid
bank
&Arc<Bank>
transactions
&[Transaction]
transaction_to_packet_indexes
&[usize]
pending_indexes
&[usize]
bank
&Arc<Bank>
transactions
&[Transaction]
transaction_to_packet_indexes
&[usize]
pending_indexes
&[usize]