@@ -367,45 +367,27 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
367367 // stage, as we already have an access to all of the accounts
368368 let mut balances = AccountsBalances :: default ( ) ;
369369
370- let mut replenish_retried = false ;
371370 let ( mut program_cache_for_tx_batch, program_cache_us) = measure_us ! ( {
372- loop {
373- let program_cache_for_tx_batch = self . replenish_program_cache(
374- callbacks,
375- & program_accounts_map,
376- & mut execute_timings,
377- config. check_program_modification_slot,
378- config. limit_to_load_programs,
379- ) ;
380-
381- // This means the cache is corrupted and runtime cannot load required programs
382- if program_cache_for_tx_batch. hit_max_limit {
383- // We retry once (will most likely succeed)
384- // But to guarantee success we clear the cache
385- if !replenish_retried {
386- replenish_retried = true ;
387- let mut cache = self . program_cache. write( ) . unwrap( ) ;
388- // We need to reset the slot to avoid debug panics
389- let slot = cache. latest_root_slot;
390- cache. latest_root_slot = 0 ;
391- cache. prune( 0 , 0 ) ;
392- // And restore the slot to previous value after prune
393- cache. latest_root_slot = slot;
394- continue ;
395- }
396-
397- return LoadAndExecuteSanitizedTransactionsOutput {
398- error_metrics,
399- execute_timings,
400- processing_results: ( 0 ..sanitized_txs. len( ) )
401- . map( |_| Err ( TransactionError :: ProgramCacheHitMaxLimit ) )
402- . collect( ) ,
403- balances,
404- } ;
405- }
371+ let program_cache_for_tx_batch = self . replenish_program_cache(
372+ callbacks,
373+ & program_accounts_map,
374+ & mut execute_timings,
375+ config. check_program_modification_slot,
376+ config. limit_to_load_programs,
377+ ) ;
406378
407- break program_cache_for_tx_batch;
379+ if program_cache_for_tx_batch. hit_max_limit {
380+ return LoadAndExecuteSanitizedTransactionsOutput {
381+ error_metrics,
382+ execute_timings,
383+ processing_results: ( 0 ..sanitized_txs. len( ) )
384+ . map( |_| Err ( TransactionError :: ProgramCacheHitMaxLimit ) )
385+ . collect( ) ,
386+ balances,
387+ } ;
408388 }
389+
390+ program_cache_for_tx_batch
409391 } ) ;
410392
411393 // Determine a capacity for the internal account cache. This
0 commit comments