pub fn submit_and_wait_txn_requests(
    client: &AdmissionControlClient,
    txn_requests: &[SubmitTransactionRequest],
) -> Vec<ProtoSubmitTransactionResponse> {
    let futures: Vec<_> = txn_requests
        .iter()
        .filter_map(|req| {
            match client.submit_transaction_async_opt(&req, get_default_grpc_call_option()) {
                Ok(future) => Some(future),
                Err(e) => {
                    OP_COUNTER.inc(&format!("submit_txns.{:?}", e));
                    error!("Failed to send gRPC request: {:?}", e);
                    None
                }
            }
        })
        .collect();
    // Wait all the futures unorderedly, then pick only accepted responses.
    stream::futures_unordered(futures)
        .wait()
        .filter_map(|future_result| match future_result {
            Ok(proto_resp) => {
                if check_ac_response(&proto_resp) {
                    Some(proto_resp)
                } else {
                    None
                }
            }
            Err(e) => {
                OP_COUNTER.inc(&format!("submit_txns.{:?}", e));
                error!("Failed to receive gRPC response: {:?}", e);
                None
            }
        })
        .collect()
}
/// Send TXN requests to AC async, wait for and check the responses from AC.
/// Return only the responses of accepted TXN requests.
/// Ignore but count both gRPC-failed submissions and AC-rejected TXNs.
Send TXN requests to AC async, wait for and check the responses from AC.
Return only the responses of accepted TXN requests.
Ignore but count both gRPC-failed submissions and AC-rejected TXNs.
Send TXN requests to AC async wait for and check the responses from AC . Return only the responses of accepted TXN requests . Ignore but count both gRPC - failed submissions and AC - rejected TXNs .
pub fn submit_and_wait_txn_requests(
    client: &AdmissionControlClient,
    txn_requests: &[SubmitTransactionRequest],
) -> Vec<ProtoSubmitTransactionResponse> {
    let futures: Vec<_> = txn_requests
        .iter()
        .filter_map(|req| {
            match client.submit_transaction_async_opt(&req, get_default_grpc_call_option()) {
                Ok(future) => Some(future),
                Err(e) => {
                    OP_COUNTER.inc(&format!("submit_txns.{:?}", e));
                    error!("Failed to send gRPC request: {:?}", e);
                    None
                }
            }
        })
        .collect();
    // Wait all the futures unorderedly, then pick only accepted responses.
    stream::futures_unordered(futures)
        .wait()
        .filter_map(|future_result| match future_result {
            Ok(proto_resp) => {
                if check_ac_response(&proto_resp) {
                    Some(proto_resp)
                } else {
                    None
                }
            }
            Err(e) => {
                OP_COUNTER.inc(&format!("submit_txns.{:?}", e));
                error!("Failed to receive gRPC response: {:?}", e);
                None
            }
        })
        .collect()
}
pub fn submit_and_wait_txn_requests ( client : & AdmissionControlClient , txn_requests : & [ SubmitTransactionRequest ] , ) -> Vec < ProtoSubmitTransactionResponse > { let futures : Vec < _ > = txn_requests . iter ( ) . filter_map ( | req | { match client . submit_transaction_async_opt ( & req , get_default_grpc_call_option ( ) ) { Ok ( future ) => Some ( future ) , Err ( e ) => { OP_COUNTER . inc ( & format ! ( " " e ) ) ; error ! ( " " e ) ; None } } } ) . collect ( ) ; // Wait all the futures unorderedly, then pick only accepted responses. stream :: futures_unordered ( futures ) . wait ( ) . filter_map ( | future_result | match future_result { Ok ( proto_resp ) => { if check_ac_response ( & proto_resp ) { Some ( proto_resp ) } else { None } } Err ( e ) => { OP_COUNTER . inc ( & format ! ( " " e ) ) ; error ! ( " " e ) ; None } } ) . collect ( ) }
Send TXN requests to AC async, wait for and check the responses from AC.
Send TXN requests to AC async wait for and check the responses from AC .
client
&AdmissionControlClient
txn_requests
&[SubmitTransactionRequest]