fn create_keyed_accounts<'a>(
        message: &'a Message,
        instruction: &'a CompiledInstruction,
        executable_accounts: &'a [(Pubkey, RefCell<Account>)],
        accounts: &'a [Rc<RefCell<Account>>],
    ) -> Result<Vec<KeyedAccount<'a>>, InstructionError> {
        let mut keyed_accounts = create_keyed_readonly_accounts(&executable_accounts);
        let mut keyed_accounts2: Vec<_> = instruction
            .accounts
            .iter()
            .map(|&index| {
                let is_signer = message.is_signer(index as usize);
                let index = index as usize;
                let key = &message.account_keys[index];
                let account = &accounts[index];
                if message.is_writable(index) {
                    KeyedAccount::new(key, is_signer, account)
                } else {
                    KeyedAccount::new_readonly(key, is_signer, account)
                }
            })
            .collect();
        keyed_accounts.append(&mut keyed_accounts2);
        Ok(keyed_accounts)
    }
/// Create the KeyedAccounts that will be passed to the program
Create the KeyedAccounts that will be passed to the program
Create the KeyedAccounts that will be passed to the program
fn create_keyed_accounts<'a>(
        message: &'a Message,
        instruction: &'a CompiledInstruction,
        executable_accounts: &'a [(Pubkey, RefCell<Account>)],
        accounts: &'a [Rc<RefCell<Account>>],
    ) -> Result<Vec<KeyedAccount<'a>>, InstructionError> {
        let mut keyed_accounts = create_keyed_readonly_accounts(&executable_accounts);
        let mut keyed_accounts2: Vec<_> = instruction
            .accounts
            .iter()
            .map(|&index| {
                let is_signer = message.is_signer(index as usize);
                let index = index as usize;
                let key = &message.account_keys[index];
                let account = &accounts[index];
                if message.is_writable(index) {
                    KeyedAccount::new(key, is_signer, account)
                } else {
                    KeyedAccount::new_readonly(key, is_signer, account)
                }
            })
            .collect();
        keyed_accounts.append(&mut keyed_accounts2);
        Ok(keyed_accounts)
    }
fn create_keyed_accounts < ' a > ( message : & ' a Message , instruction : & ' a CompiledInstruction , executable_accounts : & ' a [ ( Pubkey , RefCell < Account > ) ] , accounts : & ' a [ Rc < RefCell < Account > > ] , ) -> Result < Vec < KeyedAccount < ' a > > , InstructionError > { let mut keyed_accounts = create_keyed_readonly_accounts ( & executable_accounts ) ; let mut keyed_accounts2 : Vec < _ > = instruction . accounts . iter ( ) . map ( | & index | { let is_signer = message . is_signer ( index as usize ) ; let index = index as usize ; let key = & message . account_keys [ index ] ; let account = & accounts [ index ] ; if message . is_writable ( index ) { KeyedAccount :: new ( key , is_signer , account ) } else { KeyedAccount :: new_readonly ( key , is_signer , account ) } } ) . collect ( ) ; keyed_accounts . append ( & mut keyed_accounts2 ) ; Ok ( keyed_accounts ) }
Create the KeyedAccounts that will be passed to the program
Create the KeyedAccounts that will be passed to the program
message
&'a Message
instruction
&'a CompiledInstruction
executable_accounts
&'a [(Pubkey, RefCell<Account>)]
accounts
&'a [Rc<RefCell<Account>>]
message
&'a Message
instruction
&'a CompiledInstruction
executable_accounts
&'a [(Pubkey, RefCell<Account>)]
accounts
&'a [Rc<RefCell<Account>>]