@@ -218,27 +218,38 @@ impl Blockchain {
218218 let ( execution_result, account_updates_list) = std:: thread:: scope ( |s| {
219219 let max_queue_length_ref = & mut max_queue_length;
220220 let ( tx, rx) = channel ( ) ;
221- let execution_handle = s. spawn ( move || -> Result < _ , ChainError > {
222- let execution_result = vm. execute_block_pipeline ( block, tx, queue_length_ref) ?;
223-
224- // Validate execution went alright
225- validate_gas_used ( & execution_result. receipts , & block. header ) ?;
226- validate_receipts_root ( & block. header , & execution_result. receipts ) ?;
227- validate_requests_hash ( & block. header , & chain_config, & execution_result. requests ) ?;
228-
229- let exec_end_instant = Instant :: now ( ) ;
230- Ok ( ( execution_result, exec_end_instant) )
231- } ) ;
232- let merkleize_handle = s. spawn ( move || -> Result < _ , StoreError > {
233- let account_updates_list = self . handle_merkleization (
234- rx,
235- & parent_header,
236- queue_length_ref,
237- max_queue_length_ref,
238- ) ?;
239- let merkle_end_instant = Instant :: now ( ) ;
240- Ok ( ( account_updates_list, merkle_end_instant) )
241- } ) ;
221+ let execution_handle = std:: thread:: Builder :: new ( )
222+ . name ( "block_executor_execution" . to_string ( ) )
223+ . spawn_scoped ( s, move || -> Result < _ , ChainError > {
224+ let execution_result =
225+ vm. execute_block_pipeline ( block, tx, queue_length_ref) ?;
226+
227+ // Validate execution went alright
228+ validate_gas_used ( & execution_result. receipts , & block. header ) ?;
229+ validate_receipts_root ( & block. header , & execution_result. receipts ) ?;
230+ validate_requests_hash (
231+ & block. header ,
232+ & chain_config,
233+ & execution_result. requests ,
234+ ) ?;
235+
236+ let exec_end_instant = Instant :: now ( ) ;
237+ Ok ( ( execution_result, exec_end_instant) )
238+ } )
239+ . expect ( "Failed to spawn block_executor exec thread" ) ;
240+ let merkleize_handle = std:: thread:: Builder :: new ( )
241+ . name ( "block_executor_merkleizer" . to_string ( ) )
242+ . spawn_scoped ( s, move || -> Result < _ , StoreError > {
243+ let account_updates_list = self . handle_merkleization (
244+ rx,
245+ & parent_header,
246+ queue_length_ref,
247+ max_queue_length_ref,
248+ ) ?;
249+ let merkle_end_instant = Instant :: now ( ) ;
250+ Ok ( ( account_updates_list, merkle_end_instant) )
251+ } )
252+ . expect ( "Failed to spawn block_executor merkleizer thread" ) ;
242253 (
243254 execution_handle. join ( ) . unwrap_or_else ( |_| {
244255 Err ( ChainError :: Custom ( "execution thread panicked" . to_string ( ) ) )
0 commit comments