Replaces KeyedAccount
by BorrowedAccount
in nonce_keyed_account
. (#23214)
* Adds get_sysvar_with_account_check2 for ABIv2. * Replaces get_signers() and get_sysvar_with_account_check() in system_instruction_processor. * Replaces KeyedAccount by BorrowedAccount in nonce_keyed_account.
This commit is contained in:
committed by
GitHub
parent
da00b39f4f
commit
1a68f81f89
@ -5,7 +5,6 @@ use crate::{
|
||||
instruction::InstructionError,
|
||||
lamports::LamportsError,
|
||||
pubkey::Pubkey,
|
||||
sysvar::Sysvar,
|
||||
};
|
||||
use std::{
|
||||
cell::{RefCell, RefMut},
|
||||
@ -111,17 +110,6 @@ impl TransactionContext {
|
||||
.ok_or(InstructionError::NotEnoughAccountKeys)
|
||||
}
|
||||
|
||||
/// Checks if the account key at the given index is the belongs to the given sysvar
|
||||
pub fn check_sysvar<S: Sysvar>(
|
||||
&self,
|
||||
index_in_transaction: usize,
|
||||
) -> Result<(), InstructionError> {
|
||||
if !S::check_id(&self.account_keys[index_in_transaction]) {
|
||||
return Err(InstructionError::InvalidArgument);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Searches for an account by its key
|
||||
pub fn find_index_of_account(&self, pubkey: &Pubkey) -> Option<usize> {
|
||||
self.account_keys.iter().position(|key| key == pubkey)
|
||||
|
Reference in New Issue
Block a user