Skip to content

Commit

Permalink
generic load_transaction_accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Aug 1, 2024
1 parent 8df9a68 commit 1b509e6
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions svm/src/account_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use {
account::{Account, AccountSharedData, ReadableAccount, WritableAccount},
feature_set::{self, FeatureSet},
fee::FeeDetails,
message::SanitizedMessage,
native_loader,
nonce::State as NonceState,
pubkey::Pubkey,
Expand Down Expand Up @@ -192,7 +191,7 @@ pub(crate) fn load_accounts<CB: TransactionProcessingCallback>(

fn load_transaction_accounts<CB: TransactionProcessingCallback>(
callbacks: &CB,
message: &SanitizedMessage,
message: &impl SVMMessage,
tx_details: ValidatedTransactionDetails,
error_metrics: &mut TransactionErrorMetrics,
account_overrides: Option<&AccountOverrides>,
Expand All @@ -207,9 +206,8 @@ fn load_transaction_accounts<CB: TransactionProcessingCallback>(
let mut accumulated_accounts_data_size: u32 = 0;

let instruction_accounts = message
.instructions()
.iter()
.flat_map(|instruction| &instruction.accounts)
.instructions_iter()
.flat_map(|instruction| instruction.accounts)
.unique()
.collect::<Vec<&u8>>();

Expand Down Expand Up @@ -295,8 +293,7 @@ fn load_transaction_accounts<CB: TransactionProcessingCallback>(

let builtins_start_index = accounts.len();
let program_indices = message
.instructions()
.iter()
.instructions_iter()
.map(|instruction| {
let mut account_indices = Vec::with_capacity(2);
let program_index = instruction.program_id_index as usize;
Expand Down Expand Up @@ -416,7 +413,7 @@ fn construct_instructions_account(message: &impl SVMMessage) -> AccountSharedDat

decompiled_instructions.push(BorrowedInstruction {
accounts,
data: &instruction.data,
data: instruction.data,
program_id,
});
}
Expand Down

0 comments on commit 1b509e6

Please sign in to comment.