fn process_instruction(
        &self,
        keyed_accounts: &[KeyedAccount],
        instruction_data: &[u8],
        invoke_context: &mut dyn InvokeContext,
    ) -> Result<(), InstructionError> {
        if let Some(root_account) = keyed_accounts.iter().next() {
            if native_loader::check_id(&root_account.owner()?) {
                let root_id = root_account.unsigned_key();
                for (id, process_instruction) in &self.loaders {
                    if id == root_id {
                        // Call the program via a builtin loader
                        return process_instruction(
                            &root_id,
                            &keyed_accounts[1..],
                            instruction_data,
                            invoke_context,
                        );
                    }
                }
                for (id, process_instruction) in &self.programs {
                    if id == root_id {
                        // Call the builtin program
                        return process_instruction(
                            &root_id,
                            &keyed_accounts[1..],
                            instruction_data,
                        );
                    }
                }
                // Call the program via the native loader
                return self.native_loader.process_instruction(
                    &native_loader::id(),
                    keyed_accounts,
                    instruction_data,
                    invoke_context,
                );
            } else {
                let owner_id = &root_account.owner()?;
                for (id, process_instruction) in &self.loaders {
                    if id == owner_id {
                        // Call the program via a builtin loader
                        return process_instruction(
                            &owner_id,
                            keyed_accounts,
                            instruction_data,
                            invoke_context,
                        );
                    }
                }
            }
        }
        Err(InstructionError::UnsupportedProgramId)
    }
/// Process an instruction
/// This method calls the instruction's program entrypoint method
Process an instruction
This method calls the instruction's program entrypoint method
Process an instruction This method calls the instruction ' s program entrypoint method
fn process_instruction(
        &self,
        keyed_accounts: &[KeyedAccount],
        instruction_data: &[u8],
        invoke_context: &mut dyn InvokeContext,
    ) -> Result<(), InstructionError> {
        if let Some(root_account) = keyed_accounts.iter().next() {
            if native_loader::check_id(&root_account.owner()?) {
                let root_id = root_account.unsigned_key();
                for (id, process_instruction) in &self.loaders {
                    if id == root_id {
                        // Call the program via a builtin loader
                        return process_instruction(
                            &root_id,
                            &keyed_accounts[1..],
                            instruction_data,
                            invoke_context,
                        );
                    }
                }
                for (id, process_instruction) in &self.programs {
                    if id == root_id {
                        // Call the builtin program
                        return process_instruction(
                            &root_id,
                            &keyed_accounts[1..],
                            instruction_data,
                        );
                    }
                }
                // Call the program via the native loader
                return self.native_loader.process_instruction(
                    &native_loader::id(),
                    keyed_accounts,
                    instruction_data,
                    invoke_context,
                );
            } else {
                let owner_id = &root_account.owner()?;
                for (id, process_instruction) in &self.loaders {
                    if id == owner_id {
                        // Call the program via a builtin loader
                        return process_instruction(
                            &owner_id,
                            keyed_accounts,
                            instruction_data,
                            invoke_context,
                        );
                    }
                }
            }
        }
        Err(InstructionError::UnsupportedProgramId)
    }
fn process_instruction ( & self , keyed_accounts : & [ KeyedAccount ] , instruction_data : & [ u8 ] , invoke_context : & mut dyn InvokeContext , ) -> Result < ( ) , InstructionError > { if let Some ( root_account ) = keyed_accounts . iter ( ) . next ( ) { if native_loader :: check_id ( & root_account . owner ( ) ? ) { let root_id = root_account . unsigned_key ( ) ; for ( id , process_instruction ) in & self . loaders { if id == root_id { // Call the program via a builtin loader return process_instruction ( & root_id , & keyed_accounts [ 1 .. ] , instruction_data , invoke_context , ) ; } } for ( id , process_instruction ) in & self . programs { if id == root_id { // Call the builtin program return process_instruction ( & root_id , & keyed_accounts [ 1 .. ] , instruction_data , ) ; } } // Call the program via the native loader return self . native_loader . process_instruction ( & native_loader :: id ( ) , keyed_accounts , instruction_data , invoke_context , ) ; } else { let owner_id = & root_account . owner ( ) ? ; for ( id , process_instruction ) in & self . loaders { if id == owner_id { // Call the program via a builtin loader return process_instruction ( & owner_id , keyed_accounts , instruction_data , invoke_context , ) ; } } } } Err ( InstructionError :: UnsupportedProgramId ) }
Process an instruction
This method calls the instruction's program entrypoint method
Process an instruction This method calls the instruction ' s program entrypoint method
&self
keyed_accounts
&[KeyedAccount]
instruction_data
&[u8]
invoke_context
&mut dyn InvokeContext
&self
keyed_accounts
&[KeyedAccount]
instruction_data
&[u8]
invoke_context
&mut dyn InvokeContext