34
34
solana_transaction_context:: { IndexOfAccount , TransactionAccount } ,
35
35
solana_transaction_error:: { TransactionError , TransactionResult as Result } ,
36
36
std:: {
37
- collections:: HashMap ,
38
37
num:: { NonZeroU32 , Saturating } ,
39
38
sync:: Arc ,
40
39
} ,
@@ -110,7 +109,6 @@ pub struct FeesOnlyTransaction {
110
109
#[ cfg_attr( feature = "dev-context-only-utils" , derive( Clone ) ) ]
111
110
pub ( crate ) struct AccountLoader < ' a , CB : TransactionProcessingCallback > {
112
111
pub ( crate ) program_cache : ProgramCacheForTxBatch ,
113
- program_accounts : HashMap < Pubkey , ( & ' a Pubkey , u64 ) > ,
114
112
account_cache : AHashMap < Pubkey , AccountSharedData > ,
115
113
callbacks : & ' a CB ,
116
114
pub ( crate ) feature_set : Arc < FeatureSet > ,
@@ -119,7 +117,6 @@ impl<'a, CB: TransactionProcessingCallback> AccountLoader<'a, CB> {
119
117
pub ( crate ) fn new_with_account_cache_capacity (
120
118
account_overrides : Option < & ' a AccountOverrides > ,
121
119
program_cache : ProgramCacheForTxBatch ,
122
- program_accounts : HashMap < Pubkey , ( & ' a Pubkey , u64 ) > ,
123
120
callbacks : & ' a CB ,
124
121
feature_set : Arc < FeatureSet > ,
125
122
capacity : usize ,
@@ -138,7 +135,6 @@ impl<'a, CB: TransactionProcessingCallback> AccountLoader<'a, CB> {
138
135
program_cache,
139
136
account_cache,
140
137
callbacks,
141
- program_accounts,
142
138
feature_set,
143
139
}
144
140
}
@@ -149,24 +145,6 @@ impl<'a, CB: TransactionProcessingCallback> AccountLoader<'a, CB> {
149
145
usage_pattern : AccountUsagePattern ,
150
146
) -> Option < LoadedTransactionAccount > {
151
147
let is_writable = usage_pattern == AccountUsagePattern :: Writable ;
152
- let is_invisible_read = usage_pattern == AccountUsagePattern :: ReadOnlyInvisible ;
153
- let use_program_cache = !self
154
- . feature_set
155
- . is_active ( & feature_set:: disable_account_loader_special_case:: id ( ) ) ;
156
-
157
- if let Some ( program) = ( use_program_cache && is_invisible_read)
158
- . then_some ( ( ) )
159
- . and_then ( |_| self . program_cache . find ( account_key) )
160
- {
161
- // Optimization to skip loading of accounts which are only used as
162
- // programs in top-level instructions and not passed as instruction accounts.
163
- return Some ( LoadedTransactionAccount {
164
- loaded_size : program. account_size ,
165
- account : account_shared_data_from_program ( account_key, & self . program_accounts )
166
- . ok ( ) ?,
167
- rent_collected : 0 ,
168
- } ) ;
169
- }
170
148
171
149
let account = if let Some ( account) = self . account_cache . get ( account_key) {
172
150
// If lamports is 0, a previous transaction deallocated this account.
@@ -625,22 +603,6 @@ fn load_transaction_account<CB: TransactionProcessingCallback>(
625
603
loaded_account
626
604
}
627
605
628
- fn account_shared_data_from_program (
629
- key : & Pubkey ,
630
- program_accounts : & HashMap < Pubkey , ( & Pubkey , u64 ) > ,
631
- ) -> Result < AccountSharedData > {
632
- // It's an executable program account. The program is already loaded in the cache.
633
- // So the account data is not needed. Return a dummy AccountSharedData with meta
634
- // information.
635
- let mut program_account = AccountSharedData :: default ( ) ;
636
- let ( program_owner, _count) = program_accounts
637
- . get ( key)
638
- . ok_or ( TransactionError :: AccountNotFound ) ?;
639
- program_account. set_owner ( * * program_owner) ;
640
- program_account. set_executable ( true ) ;
641
- Ok ( program_account)
642
- }
643
-
644
606
/// Accumulate loaded account data size into `accumulated_accounts_data_size`.
645
607
/// Returns TransactionErr::MaxLoadedAccountsDataSizeExceeded if
646
608
/// `accumulated_accounts_data_size` exceeds
@@ -780,7 +742,6 @@ mod tests {
780
742
AccountLoader :: new_with_account_cache_capacity (
781
743
None ,
782
744
ProgramCacheForTxBatch :: default ( ) ,
783
- HashMap :: default ( ) ,
784
745
callbacks,
785
746
Arc :: < FeatureSet > :: default ( ) ,
786
747
0 ,
@@ -1125,7 +1086,6 @@ mod tests {
1125
1086
let mut account_loader = AccountLoader :: new_with_account_cache_capacity (
1126
1087
account_overrides,
1127
1088
ProgramCacheForTxBatch :: default ( ) ,
1128
- HashMap :: default ( ) ,
1129
1089
& callbacks,
1130
1090
Arc :: new ( FeatureSet :: all_enabled ( ) ) ,
1131
1091
0 ,
@@ -1558,8 +1518,6 @@ mod tests {
1558
1518
Hash :: default ( ) ,
1559
1519
) ) ;
1560
1520
1561
- let mut program_accounts = HashMap :: new ( ) ;
1562
- program_accounts. insert ( program_keypair. pubkey ( ) , ( & loader_v2, 0 ) ) ;
1563
1521
let mut loaded_programs = ProgramCacheForTxBatch :: default ( ) ;
1564
1522
loaded_programs. replenish (
1565
1523
program_keypair. pubkey ( ) ,
@@ -1573,7 +1531,6 @@ mod tests {
1573
1531
let mut account_loader = AccountLoader :: new_with_account_cache_capacity (
1574
1532
None ,
1575
1533
loaded_programs,
1576
- program_accounts,
1577
1534
& mock_bank,
1578
1535
Arc :: < FeatureSet > :: default ( ) ,
1579
1536
0 ,
@@ -2550,9 +2507,6 @@ mod tests {
2550
2507
2551
2508
let ( _program1_size, _) = make_account ( program1, loader_v2, true ) ;
2552
2509
2553
- let mut program_accounts = HashMap :: new ( ) ;
2554
- program_accounts. insert ( program1, ( & loader_v2, 0 ) ) ;
2555
- program_accounts. insert ( program2, ( & loader_v3, 0 ) ) ;
2556
2510
let mut program_cache = ProgramCacheForTxBatch :: default ( ) ;
2557
2511
let program1_entry = ProgramCacheEntry {
2558
2512
account_size : 0 ,
@@ -2573,7 +2527,6 @@ mod tests {
2573
2527
let mut account_loader = AccountLoader :: new_with_account_cache_capacity (
2574
2528
None ,
2575
2529
program_cache. clone ( ) ,
2576
- program_accounts. clone ( ) ,
2577
2530
& mock_bank,
2578
2531
Arc :: < FeatureSet > :: default ( ) ,
2579
2532
0 ,
0 commit comments