@@ -615,7 +615,15 @@ fd_update_hash_bank_tpool( fd_exec_slot_ctx_t * slot_ctx,
615
615
616
616
fd_collect_modified_accounts ( slot_ctx , task_data , runtime_spad );
617
617
618
- ulong wcnt = fd_tpool_worker_cnt ( tpool );
618
+ ulong wcnt = 0UL ;
619
+
620
+ /* Handle non-tpool case in a single-threaded manner */
621
+ if ( FD_LIKELY ( tpool ) ){
622
+ wcnt = fd_tpool_worker_cnt ( tpool );
623
+ } else {
624
+ wcnt = 1UL ;
625
+ }
626
+
619
627
620
628
fd_lthash_value_t * lt_hashes = fd_spad_alloc ( runtime_spad ,
621
629
FD_LTHASH_VALUE_ALIGN ,
@@ -624,18 +632,31 @@ fd_update_hash_bank_tpool( fd_exec_slot_ctx_t * slot_ctx,
624
632
fd_lthash_zero ( & lt_hashes [i ] );
625
633
}
626
634
627
- ulong cnt_per_worker = task_data -> info_sz / (wcnt - 1UL );
628
- for ( ulong worker_idx = 1UL ; worker_idx < wcnt ; worker_idx ++ ) {
629
- ulong start_idx = (worker_idx - 1UL ) * cnt_per_worker ;
630
- ulong end_idx = worker_idx != wcnt - 1 ? start_idx + cnt_per_worker - 1 : task_data -> info_sz - 1 ;
631
- fd_tpool_exec ( tpool , worker_idx , fd_account_hash_task ,
632
- task_data , start_idx , end_idx ,
633
- & lt_hashes [worker_idx ], 0UL , 0UL ,
634
- 0UL , 0UL , worker_idx , 0UL , 0UL , 0UL );
635
- }
635
+ if ( FD_LIKELY ( tpool ) ){
636
+ ulong cnt_per_worker = task_data -> info_sz / (wcnt - 1UL );
637
+ for ( ulong worker_idx = 1UL ; worker_idx < wcnt ; worker_idx ++ ) {
638
+ ulong start_idx = (worker_idx - 1UL ) * cnt_per_worker ;
639
+ ulong end_idx = worker_idx != wcnt - 1 ? start_idx + cnt_per_worker - 1 : task_data -> info_sz - 1 ;
640
+ fd_tpool_exec ( tpool , worker_idx , fd_account_hash_task ,
641
+ task_data , start_idx , end_idx ,
642
+ & lt_hashes [worker_idx ], 0UL , 0UL ,
643
+ 0UL , 0UL , worker_idx , 0UL , 0UL , 0UL );
644
+ }
636
645
637
- for ( ulong worker_idx = 1UL ; worker_idx < wcnt ; worker_idx ++ ) {
638
- fd_tpool_wait ( tpool , worker_idx );
646
+ for ( ulong worker_idx = 1UL ; worker_idx < wcnt ; worker_idx ++ ) {
647
+ fd_tpool_wait ( tpool , worker_idx );
648
+ }
649
+
650
+ } else {
651
+ for ( ulong i = 0UL ; i < task_data -> info_sz ; i ++ ) {
652
+ fd_accounts_hash_task_info_t * task_info = & task_data -> info [i ];
653
+ fd_account_hash ( slot_ctx -> funk ,
654
+ slot_ctx -> funk_txn ,
655
+ task_info ,
656
+ & lt_hashes [ 0 ],
657
+ slot_ctx -> slot_bank .slot ,
658
+ & slot_ctx -> epoch_ctx -> features );
659
+ }
639
660
}
640
661
641
662
return fd_update_hash_bank_exec_hash ( slot_ctx ,
@@ -649,46 +670,6 @@ fd_update_hash_bank_tpool( fd_exec_slot_ctx_t * slot_ctx,
649
670
runtime_spad );
650
671
}
651
672
652
- int
653
- fd_update_hash_bank ( fd_exec_slot_ctx_t * slot_ctx ,
654
- fd_capture_ctx_t * capture_ctx ,
655
- fd_hash_t * hash ,
656
- ulong signature_cnt ,
657
- fd_spad_t * runtime_spad ) {
658
-
659
- /* Collect list of changed accounts to be added to bank hash */
660
- fd_accounts_hash_task_data_t * task_data = fd_spad_alloc ( runtime_spad ,
661
- alignof(fd_accounts_hash_task_data_t ),
662
- sizeof (fd_accounts_hash_task_data_t ) );
663
-
664
- fd_collect_modified_accounts ( slot_ctx , task_data , runtime_spad );
665
-
666
- fd_lthash_value_t * lt_hash = fd_spad_alloc ( runtime_spad ,
667
- FD_LTHASH_VALUE_ALIGN ,
668
- FD_LTHASH_VALUE_FOOTPRINT );
669
- fd_lthash_zero ( lt_hash );
670
-
671
- for ( ulong i = 0UL ; i < task_data -> info_sz ; i ++ ) {
672
- fd_accounts_hash_task_info_t * task_info = & task_data -> info [i ];
673
- fd_account_hash ( slot_ctx -> funk ,
674
- slot_ctx -> funk_txn ,
675
- task_info ,
676
- lt_hash ,
677
- slot_ctx -> slot_bank .slot ,
678
- & slot_ctx -> epoch_ctx -> features );
679
- }
680
-
681
- return fd_update_hash_bank_exec_hash ( slot_ctx ,
682
- hash ,
683
- capture_ctx ,
684
- task_data ,
685
- 1UL ,
686
- lt_hash ,
687
- 1UL ,
688
- signature_cnt ,
689
- runtime_spad );
690
- }
691
-
692
673
void const *
693
674
fd_hash_account ( uchar hash [ static 32 ],
694
675
fd_lthash_value_t * lthash ,
0 commit comments