Skip to content

Commit

Permalink
Renames get_instruction_context_at => get_instruction_context_at_nest…
Browse files Browse the repository at this point in the history
…ing_level.
  • Loading branch information
Lichtso committed Aug 19, 2022
1 parent 185030a commit 0d1beb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion program-runtime/src/invoke_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ impl<'a> InvokeContext<'a> {
.get_instruction_context_stack_height())
.any(|level| {
self.transaction_context
.get_instruction_context_at(level)
.get_instruction_context_at_nesting_level(level)
.and_then(|instruction_context| {
instruction_context
.try_borrow_last_program_account(self.transaction_context)
Expand Down
10 changes: 5 additions & 5 deletions sdk/src/transaction_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,19 @@ impl TransactionContext {
}

/// Gets an InstructionContext by its nesting level in the stack
pub fn get_instruction_context_at(
pub fn get_instruction_context_at_nesting_level(
&self,
level: usize,
nesting_level: usize,
) -> Result<&InstructionContext, InstructionError> {
let index_in_trace = *self
.instruction_stack
.get(level)
.get(nesting_level)
.ok_or(InstructionError::CallDepth)?;
let instruction_context = self
.instruction_trace
.get(index_in_trace)
.ok_or(InstructionError::CallDepth)?;
debug_assert_eq!(instruction_context.nesting_level, level);
debug_assert_eq!(instruction_context.nesting_level, nesting_level);
Ok(instruction_context)
}

Expand All @@ -171,7 +171,7 @@ impl TransactionContext {
.get_instruction_context_stack_height()
.checked_sub(1)
.ok_or(InstructionError::CallDepth)?;
self.get_instruction_context_at(level)
self.get_instruction_context_at_nesting_level(level)
}

/// Pushes a new InstructionContext
Expand Down

0 comments on commit 0d1beb4

Please sign in to comment.