|
|
@@ -424,33 +424,24 @@ impl<'a> InvokeContext<'a> {
|
|
|
|
|
|
// Find and validate executables / program accounts
|
|
|
let callee_program_id = instruction.program_id;
|
|
|
- let program_account_index = if self.get_feature_set().lift_cpi_caller_restriction {
|
|
|
- self.transaction_context
|
|
|
- .find_index_of_program_account(&callee_program_id)
|
|
|
- .ok_or_else(|| {
|
|
|
- ic_msg!(self, "Unknown program {}", callee_program_id);
|
|
|
- InstructionError::MissingAccount
|
|
|
- })?
|
|
|
- } else {
|
|
|
- let program_account_index = instruction_context
|
|
|
- .find_index_of_instruction_account(self.transaction_context, &callee_program_id)
|
|
|
- .ok_or_else(|| {
|
|
|
- ic_msg!(self, "Unknown program {}", callee_program_id);
|
|
|
- InstructionError::MissingAccount
|
|
|
- })?;
|
|
|
- let borrowed_program_account = instruction_context
|
|
|
- .try_borrow_instruction_account(self.transaction_context, program_account_index)?;
|
|
|
- #[allow(deprecated)]
|
|
|
- if !self
|
|
|
- .get_feature_set()
|
|
|
- .remove_accounts_executable_flag_checks
|
|
|
- && !borrowed_program_account.is_executable()
|
|
|
- {
|
|
|
- ic_msg!(self, "Account {} is not executable", callee_program_id);
|
|
|
- return Err(InstructionError::AccountNotExecutable);
|
|
|
- }
|
|
|
- borrowed_program_account.get_index_in_transaction()
|
|
|
- };
|
|
|
+ let program_account_index = instruction_context
|
|
|
+ .find_index_of_instruction_account(self.transaction_context, &callee_program_id)
|
|
|
+ .ok_or_else(|| {
|
|
|
+ ic_msg!(self, "Unknown program {}", callee_program_id);
|
|
|
+ InstructionError::MissingAccount
|
|
|
+ })?;
|
|
|
+ let borrowed_program_account = instruction_context
|
|
|
+ .try_borrow_instruction_account(self.transaction_context, program_account_index)?;
|
|
|
+ #[allow(deprecated)]
|
|
|
+ if !self
|
|
|
+ .get_feature_set()
|
|
|
+ .remove_accounts_executable_flag_checks
|
|
|
+ && !borrowed_program_account.is_executable()
|
|
|
+ {
|
|
|
+ ic_msg!(self, "Account {} is not executable", callee_program_id);
|
|
|
+ return Err(InstructionError::AccountNotExecutable);
|
|
|
+ }
|
|
|
+ let program_account_index = borrowed_program_account.get_index_in_transaction();
|
|
|
|
|
|
Ok((instruction_accounts, vec![program_account_index]))
|
|
|
}
|