@@ -104,43 +104,44 @@ pub fn update_hord_db_and_augment_bitcoin_block(
104
104
let mut transactions_ids = vec ! [ ] ;
105
105
for new_tx in new_block. transactions . iter_mut ( ) . skip ( 1 ) {
106
106
// Have a new inscription been revealed, if so, are looking at a re-inscription
107
- for ordinal_event in
108
- new_tx. metadata . ordinal_operations . iter_mut ( )
109
- {
107
+ for ordinal_event in new_tx. metadata . ordinal_operations . iter_mut ( ) {
110
108
if let OrdinalOperation :: InscriptionRevealed ( _) = ordinal_event {
111
109
transactions_ids. push ( new_tx. transaction_identifier . clone ( ) ) ;
112
110
}
113
111
}
114
112
}
115
- let expected_traversals = transactions_ids. len ( ) ;
116
- let ( traversal_tx, traversal_rx) = channel :: < ( TransactionIdentifier , TraversalResult ) > ( ) ;
117
- let traversal_data_pool = ThreadPool :: new ( 10 ) ;
118
-
119
- for transaction_id in transactions_ids. into_iter ( ) {
120
- let moved_traversal_tx = traversal_tx. clone ( ) ;
121
- let moved_ctx = ctx. clone ( ) ;
122
- let block_identifier = new_block. block_identifier . clone ( ) ;
123
- let hord_db_path = hord_db_path. clone ( ) ;
124
- traversal_data_pool. execute ( move || {
125
- let hord_db_conn = open_readonly_hord_db_conn ( & hord_db_path, & moved_ctx) . unwrap ( ) ;
126
- let traversal = retrieve_satoshi_point_using_local_storage (
127
- & hord_db_conn,
128
- & block_identifier,
129
- & transaction_id,
130
- & moved_ctx,
131
- )
132
- . unwrap ( ) ;
133
- let _ = moved_traversal_tx. send ( ( transaction_id, traversal) ) ;
134
- } ) ;
135
- }
136
113
137
114
let mut traversals = HashMap :: new ( ) ;
138
- let mut traversals_received = 0 ;
139
- while let Ok ( ( transaction_identifier, traversal_result) ) = traversal_rx. recv ( ) {
140
- traversals_received += 1 ;
141
- traversals. insert ( transaction_identifier, traversal_result) ;
142
- if traversals_received == expected_traversals {
143
- break ;
115
+ if !transactions_ids. is_empty ( ) {
116
+ let expected_traversals = transactions_ids. len ( ) ;
117
+ let ( traversal_tx, traversal_rx) = channel :: < ( TransactionIdentifier , TraversalResult ) > ( ) ;
118
+ let traversal_data_pool = ThreadPool :: new ( 10 ) ;
119
+
120
+ for transaction_id in transactions_ids. into_iter ( ) {
121
+ let moved_traversal_tx = traversal_tx. clone ( ) ;
122
+ let moved_ctx = ctx. clone ( ) ;
123
+ let block_identifier = new_block. block_identifier . clone ( ) ;
124
+ let hord_db_path = hord_db_path. clone ( ) ;
125
+ traversal_data_pool. execute ( move || {
126
+ let hord_db_conn = open_readonly_hord_db_conn ( & hord_db_path, & moved_ctx) . unwrap ( ) ;
127
+ let traversal = retrieve_satoshi_point_using_local_storage (
128
+ & hord_db_conn,
129
+ & block_identifier,
130
+ & transaction_id,
131
+ & moved_ctx,
132
+ )
133
+ . unwrap ( ) ;
134
+ let _ = moved_traversal_tx. send ( ( transaction_id, traversal) ) ;
135
+ } ) ;
136
+ }
137
+
138
+ let mut traversals_received = 0 ;
139
+ while let Ok ( ( transaction_identifier, traversal_result) ) = traversal_rx. recv ( ) {
140
+ traversals_received += 1 ;
141
+ traversals. insert ( transaction_identifier, traversal_result) ;
142
+ if traversals_received == expected_traversals {
143
+ break ;
144
+ }
144
145
}
145
146
}
146
147
0 commit comments