Allow the same account to be passed multiple times to a single instruction (#7795)
This commit is contained in:
@@ -80,7 +80,8 @@ pub trait Sysvar:
|
||||
if !Self::check_id(keyed_account.unsigned_key()) {
|
||||
return Err(InstructionError::InvalidArgument);
|
||||
}
|
||||
Self::from_account(keyed_account.account).ok_or(InstructionError::InvalidArgument)
|
||||
Self::from_account(&*keyed_account.try_account_ref()?)
|
||||
.ok_or(InstructionError::InvalidArgument)
|
||||
}
|
||||
fn create_account(&self, lamports: u64) -> Account {
|
||||
let data_len = Self::size_of().max(bincode::serialized_size(self).unwrap() as usize);
|
||||
|
@@ -21,10 +21,7 @@ pub fn verify_rent_exemption(
|
||||
rent_sysvar_account: &KeyedAccount,
|
||||
) -> Result<(), InstructionError> {
|
||||
let rent = Rent::from_keyed_account(rent_sysvar_account)?;
|
||||
if !rent.is_exempt(
|
||||
keyed_account.account.lamports,
|
||||
keyed_account.account.data.len(),
|
||||
) {
|
||||
if !rent.is_exempt(keyed_account.lamports()?, keyed_account.data_len()?) {
|
||||
Err(InstructionError::InsufficientFunds)
|
||||
} else {
|
||||
Ok(())
|
||||
|
Reference in New Issue
Block a user