/// Record the initial state of the accounts so that they can be compared
/// after the instruction is processed
Record the initial state of the accounts so that they can be compared
after the instruction is processed
Record the initial state of the accounts so that they can be compared after the instruction is processed
pub fn create_pre_accounts(
        message: &Message,
        instruction: &CompiledInstruction,
        accounts: &[Rc<RefCell<Account>>],
    ) -> Vec<PreAccount> {
        let mut pre_accounts = Vec::with_capacity(accounts.len());
        {
            let mut work = |_unique_index: usize, account_index: usize| {
                let key = &message.account_keys[account_index];
                let is_signer = account_index < message.header.num_required_signatures as usize;
                let is_writable = message.is_writable(account_index);
                let account = accounts[account_index].borrow();
                pre_accounts.push(PreAccount::new(key, &account, is_signer, is_writable));
                Ok(())
            };
            let _ = instruction.visit_each_account(&mut work);
        }
        pre_accounts
    }
pub fn create_pre_accounts ( message : & Message , instruction : & CompiledInstruction , accounts : & [ Rc < RefCell < Account > > ] , ) -> Vec < PreAccount > { let mut pre_accounts = Vec :: with_capacity ( accounts . len ( ) ) ; { let mut work = | _unique_index : usize , account_index : usize | { let key = & message . account_keys [ account_index ] ; let is_signer = account_index < message . header . num_required_signatures as usize ; let is_writable = message . is_writable ( account_index ) ; let account = accounts [ account_index ] . borrow ( ) ; pre_accounts . push ( PreAccount :: new ( key , & account , is_signer , is_writable ) ) ; Ok ( ( ) ) } ; let _ = instruction . visit_each_account ( & mut work ) ; } pre_accounts }
Record the initial state of the accounts so that they can be compared
after the instruction is processed
Record the initial state of the accounts so that they can be compared after the instruction is processed
message
&Message
instruction
&CompiledInstruction
accounts
&[Rc<RefCell<Account>>]