diff --git a/runtime/src/account_rent_state.rs b/runtime/src/account_rent_state.rs index 1683eb065dec3c..976390275594d3 100644 --- a/runtime/src/account_rent_state.rs +++ b/runtime/src/account_rent_state.rs @@ -51,47 +51,15 @@ pub(crate) fn submit_rent_state_metrics(pre_rent_state: &RentState, post_rent_st pub(crate) fn check_rent_state( pre_rent_state: Option<&RentState>, post_rent_state: Option<&RentState>, - pubkey: &Pubkey, + address: &Pubkey, account: &AccountSharedData, ) -> Result<()> { if let Some((pre_rent_state, post_rent_state)) = pre_rent_state.zip(post_rent_state) { -<<<<<<< HEAD submit_rent_state_metrics(pre_rent_state, post_rent_state); if !post_rent_state.transition_allowed_from(pre_rent_state) { - debug!("Account {:?} not rent exempt, state {:?}", pubkey, account,); + debug!("Account {:?} not rent exempt, state {:?}", address, account); return Err(TransactionError::InvalidRentPayingAccount); } -======= - let expect_msg = "account must exist at TransactionContext index if rent-states are Some"; - check_rent_state_with_account( - pre_rent_state, - post_rent_state, - transaction_context - .get_key_of_account_at_index(index) - .expect(expect_msg), - &transaction_context - .get_account_at_index(index) - .expect(expect_msg) - .borrow(), - )?; - } - Ok(()) -} - -pub(crate) fn check_rent_state_with_account( - pre_rent_state: &RentState, - post_rent_state: &RentState, - address: &Pubkey, - account_state: &AccountSharedData, -) -> Result<()> { - submit_rent_state_metrics(pre_rent_state, post_rent_state); - if !post_rent_state.transition_allowed_from(pre_rent_state) { - debug!( - "Account {} not rent exempt, state {:?}", - address, account_state, - ); - return Err(TransactionError::InvalidRentPayingAccount); ->>>>>>> 36484f4f0 (Prevent new RentPaying state created by paying fees (#23358)) } Ok(()) } diff --git a/runtime/src/accounts.rs b/runtime/src/accounts.rs index f66866ad0db9f4..c4e2c15dbd8c74 100644 --- a/runtime/src/accounts.rs +++ b/runtime/src/accounts.rs @@ -1,6 +1,6 @@ use { crate::{ - account_rent_state::{check_rent_state_with_account, RentState}, + account_rent_state::{check_rent_state, RentState}, accounts_db::{ AccountShrinkThreshold, AccountsAddRootTiming, AccountsDb, AccountsDbConfig, BankHashInfo, ErrorCounters, LoadHint, LoadedAccount, ScanStorageResult, @@ -406,14 +406,14 @@ impl Accounts { let payer_post_rent_state = RentState::from_account(payer_account, &rent_collector.rent); - let rent_state_result = check_rent_state_with_account( - &payer_pre_rent_state, - &payer_post_rent_state, + let rent_state_result = check_rent_state( + Some(&payer_pre_rent_state), + Some(&payer_post_rent_state), payer_address, payer_account, ); // Feature gate only wraps the actual error return so that the metrics and debug - // logging generated by `check_rent_state_with_account()` can be examined before + // logging generated by `check_rent_state()` can be examined before // feature activation if feature_set.is_active(&feature_set::require_rent_exempt_accounts::id()) { rent_state_result?;