/// Conduct a transfer between two clients, according to the policy.
/// Returns the transaction and the block count of the node it was submitted
/// to.
Conduct a transfer between two clients, according to the policy.
Returns the transaction and the block count of the node it was submitted
to.
Conduct a transfer between two clients according to the policy . Returns the transaction and the block count of the node it was submitted to .
fn transfer(
        &self,
        source_client: &mut Client,
        target_client: &mut Client,
    ) -> Result<(Tx, u64), TestClientError> {
        let target_address = target_client.get_account_key().default_subaddress();
        log::debug!(
            self.logger,
            "Attempting to transfer {} ({})",
            self.policy.transfer_amount,
            source_client.consensus_service_address()
        );
        // First do a balance check to flush out any spent txos
        let tracer = tracer!();
        tracer.in_span("pre_transfer_balance_check", |_cx| {
            source_client
                .check_balance()
                .map_err(TestClientError::CheckBalance)
        })?;
        let mut rng = McRng::default();
        assert!(target_address.fog_report_url().is_some());
        // Get the current fee from consensus
        let fee = source_client.get_fee().unwrap_or(MINIMUM_FEE);
        let transaction = source_client
            .build_transaction(self.policy.transfer_amount, &target_address, &mut rng, fee)
            .map_err(TestClientError::BuildTx)?;
        let block_count = source_client
            .send_transaction(&transaction)
            .map_err(TestClientError::SubmitTx)?;
        Ok((transaction, block_count))
    }
fn transfer ( & self , source_client : & mut Client , target_client : & mut Client , ) -> Result < ( Tx , u64 ) , TestClientError > { let target_address = target_client . get_account_key ( ) . default_subaddress ( ) ; log :: debug ! ( self logger " " self policy transfer_amount source_client consensus_service_address ( ) ) ; // First do a balance check to flush out any spent txos let tracer = tracer ! ( ) ; tracer . in_span ( " " , | _cx | { source_client . check_balance ( ) . map_err ( TestClientError :: CheckBalance ) } ) ? ; let mut rng = McRng :: default ( ) ; assert ! ( target_address fog_report_url ( ) is_some ( ) ) ; // Get the current fee from consensus let fee = source_client . get_fee ( ) . unwrap_or ( MINIMUM_FEE ) ; let transaction = source_client . build_transaction ( self . policy . transfer_amount , & target_address , & mut rng , fee ) . map_err ( TestClientError :: BuildTx ) ? ; let block_count = source_client . send_transaction ( & transaction ) . map_err ( TestClientError :: SubmitTx ) ? ; Ok ( ( transaction , block_count ) ) }
Conduct a transfer between two clients, according to the policy.
Conduct a transfer between two clients according to the policy .
&self
source_client
&mut Client
target_client
&mut Client