fn check_and_apply_transfer_output(
    executor: &mut FakeExecutor,
    txn_args: &[TxnInfo],
    output: &[TransactionOutput],
) {
    let count = output.len();
    for i in 0..count {
        let txn_info = &txn_args[i];
        let sender = &txn_info.sender;
        let receiver = &txn_info.receiver;
        let transfer_amount = txn_info.transfer_amount;
        let sender_resource = executor
            .read_account_resource(&sender)
            .expect("sender must exist");
        let sender_balance = executor
            .read_balance_resource(&sender, account::lbr_currency_code())
            .expect("sender balance must exist");
        let sender_initial_balance = sender_balance.coin();
        let sender_seq_num = sender_resource.sequence_number();
        let receiver_initial_balance = executor
            .read_balance_resource(&receiver, account::lbr_currency_code())
            .expect("receiver balance must exist")
            .coin();

        // apply single transaction to DB
        let txn_output = &output[i];
        executor.apply_write_set(txn_output.write_set());

        // check that numbers stored in DB are correct
        let gas = txn_output.gas_used();
        let sender_balance = sender_initial_balance - transfer_amount - gas;
        let receiver_balance = receiver_initial_balance + transfer_amount;
        let updated_sender = executor
            .read_account_resource(&sender)
            .expect("sender must exist");
        let updated_sender_balance = executor
            .read_balance_resource(&sender, account::lbr_currency_code())
            .expect("sender balance must exist");
        let updated_receiver_balance = executor
            .read_balance_resource(&receiver, account::lbr_currency_code())
            .expect("receiver balance must exist");
        assert_eq!(receiver_balance, updated_receiver_balance.coin());
        assert_eq!(sender_balance, updated_sender_balance.coin());
        assert_eq!(sender_seq_num + 1, updated_sender.sequence_number());
    }
}
// Verify a transfer output.
// Checks that sender and receiver in a peer to peer transaction are in proper
// state after a successful transfer.
// The transaction arguments are provided in txn_args.
// Apply the WriteSet to the data store.
Verify a transfer output.
Checks that sender and receiver in a peer to peer transaction are in proper
state after a successful transfer.
The transaction arguments are provided in txn_args.
Apply the WriteSet to the data store.
Verify a transfer output . Checks that sender and receiver in a peer to peer transaction are in proper state after a successful transfer . The transaction arguments are provided in txn_args . Apply the WriteSet to the data store .
fn check_and_apply_transfer_output(
    executor: &mut FakeExecutor,
    txn_args: &[TxnInfo],
    output: &[TransactionOutput],
) {
    let count = output.len();
    for i in 0..count {
        let txn_info = &txn_args[i];
        let sender = &txn_info.sender;
        let receiver = &txn_info.receiver;
        let transfer_amount = txn_info.transfer_amount;
        let sender_resource = executor
            .read_account_resource(&sender)
            .expect("sender must exist");
        let sender_balance = executor
            .read_balance_resource(&sender, account::lbr_currency_code())
            .expect("sender balance must exist");
        let sender_initial_balance = sender_balance.coin();
        let sender_seq_num = sender_resource.sequence_number();
        let receiver_initial_balance = executor
            .read_balance_resource(&receiver, account::lbr_currency_code())
            .expect("receiver balance must exist")
            .coin();
        // apply single transaction to DB
        let txn_output = &output[i];
        executor.apply_write_set(txn_output.write_set());
        // check that numbers stored in DB are correct
        let gas = txn_output.gas_used();
        let sender_balance = sender_initial_balance - transfer_amount - gas;
        let receiver_balance = receiver_initial_balance + transfer_amount;
        let updated_sender = executor
            .read_account_resource(&sender)
            .expect("sender must exist");
        let updated_sender_balance = executor
            .read_balance_resource(&sender, account::lbr_currency_code())
            .expect("sender balance must exist");
        let updated_receiver_balance = executor
            .read_balance_resource(&receiver, account::lbr_currency_code())
            .expect("receiver balance must exist");
        assert_eq!(receiver_balance, updated_receiver_balance.coin());
        assert_eq!(sender_balance, updated_sender_balance.coin());
        assert_eq!(sender_seq_num + 1, updated_sender.sequence_number());
    }
}
fn check_and_apply_transfer_output ( executor : & mut FakeExecutor , txn_args : & [ TxnInfo ] , output : & [ TransactionOutput ] , ) { let count = output . len ( ) ; for i in 0 .. count { let txn_info = & txn_args [ i ] ; let sender = & txn_info . sender ; let receiver = & txn_info . receiver ; let transfer_amount = txn_info . transfer_amount ; let sender_resource = executor . read_account_resource ( & sender ) . expect ( " " ) ; let sender_balance = executor . read_balance_resource ( & sender , account :: lbr_currency_code ( ) ) . expect ( " " ) ; let sender_initial_balance = sender_balance . coin ( ) ; let sender_seq_num = sender_resource . sequence_number ( ) ; let receiver_initial_balance = executor . read_balance_resource ( & receiver , account :: lbr_currency_code ( ) ) . expect ( " " ) . coin ( ) ; // apply single transaction to DB let txn_output = & output [ i ] ; executor . apply_write_set ( txn_output . write_set ( ) ) ; // check that numbers stored in DB are correct let gas = txn_output . gas_used ( ) ; let sender_balance = sender_initial_balance - transfer_amount - gas ; let receiver_balance = receiver_initial_balance + transfer_amount ; let updated_sender = executor . read_account_resource ( & sender ) . expect ( " " ) ; let updated_sender_balance = executor . read_balance_resource ( & sender , account :: lbr_currency_code ( ) ) . expect ( " " ) ; let updated_receiver_balance = executor . read_balance_resource ( & receiver , account :: lbr_currency_code ( ) ) . expect ( " " ) ; assert_eq ! ( receiver_balance updated_receiver_balance coin ( ) ) ; assert_eq ! ( sender_balance updated_sender_balance coin ( ) ) ; assert_eq ! ( sender_seq_num 1 updated_sender sequence_number ( ) ) ; } }
Verify a transfer output.
Verify a transfer output .
executor
&mut FakeExecutor
txn_args
&[TxnInfo]
output
&[TransactionOutput]
executor
&mut FakeExecutor
txn_args
&[TxnInfo]
output
&[TransactionOutput]