From 7b86646dad3743507c870b69c12eb89af467c056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Mon, 6 Mar 2023 12:03:04 +0100 Subject: [PATCH] Removes get_index_in_transaction() and try_borrow_account(). --- programs/bpf_loader/src/lib.rs | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/programs/bpf_loader/src/lib.rs b/programs/bpf_loader/src/lib.rs index cf6da3d6923208..bea7a4c6fb8e17 100644 --- a/programs/bpf_loader/src/lib.rs +++ b/programs/bpf_loader/src/lib.rs @@ -86,40 +86,6 @@ pub enum BpfError { } impl UserDefinedError for BpfError {} -// The BPF loader is special in that it is the only place in the runtime and its built-in programs, -// where data comes not only from instruction account but also program accounts. -// Thus, these two helper methods have to distinguish the mixed sources via index_in_instruction. - -fn get_index_in_transaction( - instruction_context: &InstructionContext, - index_in_instruction: IndexOfAccount, -) -> Result { - if index_in_instruction < instruction_context.get_number_of_program_accounts() { - instruction_context.get_index_of_program_account_in_transaction(index_in_instruction) - } else { - instruction_context.get_index_of_instruction_account_in_transaction( - index_in_instruction - .saturating_sub(instruction_context.get_number_of_program_accounts()), - ) - } -} - -fn try_borrow_account<'a>( - transaction_context: &'a TransactionContext, - instruction_context: &'a InstructionContext, - index_in_instruction: IndexOfAccount, -) -> Result, InstructionError> { - if index_in_instruction < instruction_context.get_number_of_program_accounts() { - instruction_context.try_borrow_program_account(transaction_context, index_in_instruction) - } else { - instruction_context.try_borrow_instruction_account( - transaction_context, - index_in_instruction - .saturating_sub(instruction_context.get_number_of_program_accounts()), - ) - } -} - #[allow(clippy::too_many_arguments)] pub fn load_program_from_bytes( feature_set: &FeatureSet,