Cleanup - include_account_index_in_rent_error (#31770)

include_account_index_in_rent_error
This commit is contained in:
Alexander Meißner 2023-05-23 15:02:55 +02:00 committed by GitHub
parent 183e7fd60f
commit d866fce3d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 17 deletions

View File

@ -78,7 +78,6 @@ pub(crate) fn check_rent_state(
post_rent_state: Option<&RentState>,
transaction_context: &TransactionContext,
index: IndexOfAccount,
include_account_index_in_err: bool,
) -> Result<()> {
if let Some((pre_rent_state, post_rent_state)) = pre_rent_state.zip(post_rent_state) {
let expect_msg = "account must exist at TransactionContext index if rent-states are Some";
@ -92,7 +91,7 @@ pub(crate) fn check_rent_state(
.get_account_at_index(index)
.expect(expect_msg)
.borrow(),
include_account_index_in_err.then_some(index),
index,
)?;
}
Ok(())
@ -103,7 +102,7 @@ pub(crate) fn check_rent_state_with_account(
post_rent_state: &RentState,
address: &Pubkey,
account_state: &AccountSharedData,
account_index: Option<IndexOfAccount>,
account_index: IndexOfAccount,
) -> Result<()> {
submit_rent_state_metrics(pre_rent_state, post_rent_state);
if !solana_sdk::incinerator::check_id(address)
@ -113,12 +112,8 @@ pub(crate) fn check_rent_state_with_account(
"Account {} not rent exempt, state {:?}",
address, account_state,
);
if let Some(account_index) = account_index {
let account_index = account_index as u8;
Err(TransactionError::InsufficientFundsForRent { account_index })
} else {
Err(TransactionError::InvalidRentPayingAccount)
}
let account_index = account_index as u8;
Err(TransactionError::InsufficientFundsForRent { account_index })
} else {
Ok(())
}

View File

@ -623,9 +623,7 @@ impl Accounts {
&payer_post_rent_state,
payer_address,
payer_account,
feature_set
.is_active(&feature_set::include_account_index_in_rent_error::ID)
.then_some(payer_index),
payer_index,
)
}

View File

@ -5,7 +5,6 @@ use {
},
solana_sdk::{
account::ReadableAccount,
feature_set,
message::SanitizedMessage,
native_loader,
transaction::Result,
@ -61,9 +60,6 @@ impl Bank {
post_state_infos: &[TransactionAccountStateInfo],
transaction_context: &TransactionContext,
) -> Result<()> {
let include_account_index_in_err = self
.feature_set
.is_active(&feature_set::include_account_index_in_rent_error::id());
for (i, (pre_state_info, post_state_info)) in
pre_state_infos.iter().zip(post_state_infos).enumerate()
{
@ -72,7 +68,6 @@ impl Bank {
post_state_info.rent_state.as_ref(),
transaction_context,
i as IndexOfAccount,
include_account_index_in_err,
)?;
}
Ok(())