pub fn gen_ring_txn_requests(
        &self,
        accounts: &mut [AccountData],
    ) -> Vec<SubmitTransactionRequest> {
        let mut receiver_addrs: Vec<AccountAddress> =
            accounts.iter().map(|account| account.address).collect();
        receiver_addrs.rotate_left(1);
        accounts
            .iter_mut()
            .zip(receiver_addrs.iter())
            .flat_map(|(sender, receiver_addr)| {
                self.gen_transfer_txn_request(sender, receiver_addr, 1)
                    .or_else(|e| {
                        error!(
                            "failed to generate {:?} to {:?} transfer TXN: {:?}",
                            sender.address, receiver_addr, e
                        );
                        Err(e)
                    })
            })
            .collect()
    }
/// Pre-generate TXN requests of a circle of transfers.
/// For example, given account (A1, A2, A3, ..., AN), this method returns a vector of TXNs
/// like (A1->A2, A2->A3, A3->A4, ..., AN->A1).
Pre-generate TXN requests of a circle of transfers.
Pre - generate TXN requests of a circle of transfers .
pub fn gen_ring_txn_requests(
        &self,
        accounts: &mut [AccountData],
    ) -> Vec<SubmitTransactionRequest> {
        let mut receiver_addrs: Vec<AccountAddress> =
            accounts.iter().map(|account| account.address).collect();
        receiver_addrs.rotate_left(1);
        accounts
            .iter_mut()
            .zip(receiver_addrs.iter())
            .flat_map(|(sender, receiver_addr)| {
                self.gen_transfer_txn_request(sender, receiver_addr, 1)
                    .or_else(|e| {
                        error!(
                            "failed to generate {:?} to {:?} transfer TXN: {:?}",
                            sender.address, receiver_addr, e
                        );
                        Err(e)
                    })
            })
            .collect()
    }
pub fn gen_ring_txn_requests ( & self , accounts : & mut [ AccountData ] , ) -> Vec < SubmitTransactionRequest > { let mut receiver_addrs : Vec < AccountAddress > = accounts . iter ( ) . map ( | account | account . address ) . collect ( ) ; receiver_addrs . rotate_left ( 1 ) ; accounts . iter_mut ( ) . zip ( receiver_addrs . iter ( ) ) . flat_map ( | ( sender , receiver_addr ) | { self . gen_transfer_txn_request ( sender , receiver_addr , 1 ) . or_else ( | e | { error ! ( " " sender address receiver_addr e ) ; Err ( e ) } ) } ) . collect ( ) }
Pre-generate TXN requests of a circle of transfers.
Pre - generate TXN requests of a circle of transfers .
&self
accounts
&mut [AccountData]