@@ -1192,8 +1192,8 @@ pub fn retrieve_inscribed_satoshi_points_from_block_v3(
1192
1192
let expected_traversals = transactions_ids. len ( ) + l1_cache_hits. len ( ) ;
1193
1193
let ( traversal_tx, traversal_rx) = channel ( ) ;
1194
1194
1195
- let traversal_data_pool = ThreadPool :: new ( thread_max) ;
1196
1195
let mut tx_thread_pool = vec ! [ ] ;
1196
+ let mut thread_pool_handles = vec ! [ ] ;
1197
1197
1198
1198
for thread_index in 0 ..thread_max {
1199
1199
let ( tx, rx) = channel ( ) ;
@@ -1204,23 +1204,30 @@ pub fn retrieve_inscribed_satoshi_points_from_block_v3(
1204
1204
let moved_hord_db_path = hord_config. db_path . clone ( ) ;
1205
1205
let local_cache = cache_l2. clone ( ) ;
1206
1206
1207
- traversal_data_pool. execute ( move || {
1208
- while let Ok ( Some ( ( transaction_id, block_identifier, input_index, prioritary) ) ) =
1209
- rx. recv ( )
1210
- {
1211
- let traversal: Result < TraversalResult , String > =
1212
- retrieve_satoshi_point_using_lazy_storage_v3 (
1213
- & moved_hord_db_path,
1214
- & block_identifier,
1215
- & transaction_id,
1216
- input_index,
1217
- 0 ,
1218
- & local_cache,
1219
- & moved_ctx,
1220
- ) ;
1221
- let _ = moved_traversal_tx. send ( ( traversal, prioritary, thread_index) ) ;
1222
- }
1223
- } ) ;
1207
+ let handle = hiro_system_kit:: thread_named ( "Worker" )
1208
+ . spawn ( move || {
1209
+ while let Ok ( Some ( (
1210
+ transaction_id,
1211
+ block_identifier,
1212
+ input_index,
1213
+ prioritary,
1214
+ ) ) ) = rx. recv ( )
1215
+ {
1216
+ let traversal: Result < TraversalResult , String > =
1217
+ retrieve_satoshi_point_using_lazy_storage_v3 (
1218
+ & moved_hord_db_path,
1219
+ & block_identifier,
1220
+ & transaction_id,
1221
+ input_index,
1222
+ 0 ,
1223
+ & local_cache,
1224
+ & moved_ctx,
1225
+ ) ;
1226
+ let _ = moved_traversal_tx. send ( ( traversal, prioritary, thread_index) ) ;
1227
+ }
1228
+ } )
1229
+ . expect ( "unable to spawn thread" ) ;
1230
+ thread_pool_handles. push ( handle) ;
1224
1231
}
1225
1232
1226
1233
// Empty cache
@@ -1335,12 +1342,14 @@ pub fn retrieve_inscribed_satoshi_points_from_block_v3(
1335
1342
}
1336
1343
}
1337
1344
}
1338
- for thread_index in 0 ..thread_max {
1339
- let _ = tx_thread_pool [ thread_index ] . send ( None ) ;
1345
+ for tx in tx_thread_pool . iter ( ) {
1346
+ let _ = tx . send ( None ) ;
1340
1347
}
1341
1348
1342
1349
let _ = hiro_system_kit:: thread_named ( "Garbage collection" ) . spawn ( move || {
1343
- let _ = traversal_data_pool. join ( ) ;
1350
+ for handle in thread_pool_handles. into_iter ( ) {
1351
+ let _ = handle. join ( ) ;
1352
+ }
1344
1353
} ) ;
1345
1354
} else {
1346
1355
ctx. try_log ( |logger| {
0 commit comments