fn process_transactions(
        bank: &Arc<Bank>,
        bank_creation_time: &Instant,
        transactions: &[Transaction],
        poh: &TransactionRecorder,
        transaction_status_sender: Option<TransactionStatusSender>,
        gossip_vote_sender: &ReplayVoteSender,
    ) -> (usize, Vec<usize>) {
        let mut chunk_start = 0;
        let mut unprocessed_txs = vec![];
        while chunk_start != transactions.len() {
            let chunk_end = std::cmp::min(
                transactions.len(),
                chunk_start + MAX_NUM_TRANSACTIONS_PER_BATCH,
            );

            let (result, retryable_txs_in_chunk) = Self::process_and_record_transactions(
                bank,
                &transactions[chunk_start..chunk_end],
                poh,
                chunk_start,
                transaction_status_sender.clone(),
                gossip_vote_sender,
            );
            trace!("process_transactions result: {:?}", result);

            // Add the retryable txs (transactions that errored in a way that warrants a retry)
            // to the list of unprocessed txs.
            unprocessed_txs.extend_from_slice(&retryable_txs_in_chunk);

            // If `bank_creation_time` is None, it's a test so ignore the option so
            // allow processing
            let should_bank_still_be_processing_txs =
                Bank::should_bank_still_be_processing_txs(bank_creation_time, bank.ns_per_slot);
            match (result, should_bank_still_be_processing_txs) {
                (Err(PohRecorderError::MaxHeightReached), _) | (_, false) => {
                    info!(
                        "process transactions: max height reached slot: {} height: {}",
                        bank.slot(),
                        bank.tick_height()
                    );
                    // process_and_record_transactions has returned all retryable errors in
                    // transactions[chunk_start..chunk_end], so we just need to push the remaining
                    // transactions into the unprocessed queue.
                    unprocessed_txs.extend(chunk_end..transactions.len());
                    break;
                }
                _ => (),
            }
            // Don't exit early on any other type of error, continue processing...
            chunk_start = chunk_end;
        }

        (chunk_start, unprocessed_txs)
    }
/// Sends transactions to the bank.
///
/// Returns the number of transactions successfully processed by the bank, which may be less
/// than the total number if max PoH height was reached and the bank halted
Sends transactions to the bank.
Returns the number of transactions successfully processed by the bank, which may be less
than the total number if max PoH height was reached and the bank halted
Sends transactions to the bank . Returns the number of transactions successfully processed by the bank which may be less than the total number if max PoH height was reached and the bank halted
fn process_transactions(
        bank: &Arc<Bank>,
        bank_creation_time: &Instant,
        transactions: &[Transaction],
        poh: &TransactionRecorder,
        transaction_status_sender: Option<TransactionStatusSender>,
        gossip_vote_sender: &ReplayVoteSender,
    ) -> (usize, Vec<usize>) {
        let mut chunk_start = 0;
        let mut unprocessed_txs = vec![];
        while chunk_start != transactions.len() {
            let chunk_end = std::cmp::min(
                transactions.len(),
                chunk_start + MAX_NUM_TRANSACTIONS_PER_BATCH,
            );
            let (result, retryable_txs_in_chunk) = Self::process_and_record_transactions(
                bank,
                &transactions[chunk_start..chunk_end],
                poh,
                chunk_start,
                transaction_status_sender.clone(),
                gossip_vote_sender,
            );
            trace!("process_transactions result: {:?}", result);
            // Add the retryable txs (transactions that errored in a way that warrants a retry)
            // to the list of unprocessed txs.
            unprocessed_txs.extend_from_slice(&retryable_txs_in_chunk);
            // If `bank_creation_time` is None, it's a test so ignore the option so
            // allow processing
            let should_bank_still_be_processing_txs =
                Bank::should_bank_still_be_processing_txs(bank_creation_time, bank.ns_per_slot);
            match (result, should_bank_still_be_processing_txs) {
                (Err(PohRecorderError::MaxHeightReached), _) | (_, false) => {
                    info!(
                        "process transactions: max height reached slot: {} height: {}",
                        bank.slot(),
                        bank.tick_height()
                    );
                    // process_and_record_transactions has returned all retryable errors in
                    // transactions[chunk_start..chunk_end], so we just need to push the remaining
                    // transactions into the unprocessed queue.
                    unprocessed_txs.extend(chunk_end..transactions.len());
                    break;
                }
                _ => (),
            }
            // Don't exit early on any other type of error, continue processing...
            chunk_start = chunk_end;
        }
        (chunk_start, unprocessed_txs)
    }
fn process_transactions ( bank : & Arc < Bank > , bank_creation_time : & Instant , transactions : & [ Transaction ] , poh : & TransactionRecorder , transaction_status_sender : Option < TransactionStatusSender > , gossip_vote_sender : & ReplayVoteSender , ) -> ( usize , Vec < usize > ) { let mut chunk_start = 0 ; let mut unprocessed_txs = vec ! [ ] ; while chunk_start != transactions . len ( ) { let chunk_end = std :: cmp :: min ( transactions . len ( ) , chunk_start + MAX_NUM_TRANSACTIONS_PER_BATCH , ) ; let ( result , retryable_txs_in_chunk ) = Self :: process_and_record_transactions ( bank , & transactions [ chunk_start .. chunk_end ] , poh , chunk_start , transaction_status_sender . clone ( ) , gossip_vote_sender , ) ; trace ! ( " " result ) ; // Add the retryable txs (transactions that errored in a way that warrants a retry) // to the list of unprocessed txs. unprocessed_txs . extend_from_slice ( & retryable_txs_in_chunk ) ; // If `bank_creation_time` is None, it's a test so ignore the option so // allow processing let should_bank_still_be_processing_txs = Bank :: should_bank_still_be_processing_txs ( bank_creation_time , bank . ns_per_slot ) ; match ( result , should_bank_still_be_processing_txs ) { ( Err ( PohRecorderError :: MaxHeightReached ) , _ ) | ( _ , false ) => { info ! ( " " bank slot ( ) bank tick_height ( ) ) ; // process_and_record_transactions has returned all retryable errors in // transactions[chunk_start..chunk_end], so we just need to push the remaining // transactions into the unprocessed queue. unprocessed_txs . extend ( chunk_end .. transactions . len ( ) ) ; break ; } _ => ( ) , } // Don't exit early on any other type of error, continue processing... chunk_start = chunk_end ; } ( chunk_start , unprocessed_txs ) }
Sends transactions to the bank.
Sends transactions to the bank .
bank
&Arc<Bank>
bank_creation_time
&Instant
transactions
&[Transaction]
poh
&TransactionRecorder
transaction_status_sender
Option<TransactionStatusSender>
gossip_vote_sender
&ReplayVoteSender
bank
&Arc<Bank>
bank_creation_time
&Instant
transactions
&[Transaction]
poh
&TransactionRecorder
transaction_status_sender
Option<TransactionStatusSender>
gossip_vote_sender
&ReplayVoteSender