@@ -20,18 +20,18 @@ use crate::{
20
20
hord:: {
21
21
db:: {
22
22
find_inscription_with_ordinal_number, find_inscriptions_at_wached_outpoint,
23
- insert_entry_in_blocks,
24
- retrieve_satoshi_point_using_local_storage, store_new_inscription,
25
- update_transfered_inscription, CompactedBlock ,
23
+ insert_entry_in_blocks, retrieve_satoshi_point_using_local_storage,
24
+ store_new_inscription, update_transfered_inscription, CompactedBlock ,
26
25
} ,
27
26
ord:: height:: Height ,
28
27
} ,
29
28
utils:: Context ,
30
29
} ;
31
30
32
31
use self :: db:: {
33
- find_inscription_with_id, open_readonly_hord_db_conn_rocks_db, remove_entry_from_blocks,
34
- remove_entry_from_inscriptions, TraversalResult , WatchedSatpoint , find_latest_inscription_number_at_block_height,
32
+ find_inscription_with_id, find_latest_inscription_number_at_block_height,
33
+ open_readonly_hord_db_conn_rocks_db, remove_entry_from_blocks, remove_entry_from_inscriptions,
34
+ TraversalResult , WatchedSatpoint ,
35
35
} ;
36
36
37
37
pub fn get_inscriptions_revealed_in_block (
@@ -202,13 +202,33 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data(
202
202
inscription_db_conn : & Connection ,
203
203
ctx : & Context ,
204
204
) {
205
+ let mut latest_inscription_number = match find_latest_inscription_number_at_block_height (
206
+ & block. block_identifier . index ,
207
+ & inscription_db_conn,
208
+ & ctx,
209
+ ) {
210
+ Ok ( None ) => 0 ,
211
+ Ok ( Some ( inscription_number) ) => inscription_number + 1 ,
212
+ Err ( e) => {
213
+ ctx. try_log ( |logger| {
214
+ slog:: error!(
215
+ logger,
216
+ "unable to retrieve inscription number: {}" ,
217
+ e. to_string( )
218
+ ) ;
219
+ } ) ;
220
+ return ;
221
+ }
222
+ } ;
205
223
for new_tx in block. transactions . iter_mut ( ) . skip ( 1 ) {
206
224
let mut ordinals_events_indexes_to_discard = VecDeque :: new ( ) ;
207
225
// Have a new inscription been revealed, if so, are looking at a re-inscription
208
226
for ( ordinal_event_index, ordinal_event) in
209
227
new_tx. metadata . ordinal_operations . iter_mut ( ) . enumerate ( )
210
228
{
211
229
if let OrdinalOperation :: InscriptionRevealed ( inscription) = ordinal_event {
230
+ let inscription_number = latest_inscription_number;
231
+ latest_inscription_number += 1 ;
212
232
let traversal = match traversals. get ( & new_tx. transaction_identifier ) {
213
233
Some ( traversal) => traversal,
214
234
None => {
@@ -248,21 +268,7 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data(
248
268
} ) ;
249
269
ordinals_events_indexes_to_discard. push_front ( ordinal_event_index) ;
250
270
} else {
251
- inscription. inscription_number =
252
- match find_latest_inscription_number_at_block_height ( & block. block_identifier . index , & inscription_db_conn, & ctx) {
253
- Ok ( None ) => 0 ,
254
- Ok ( Some ( inscription_number) ) => inscription_number + 1 ,
255
- Err ( e) => {
256
- ctx. try_log ( |logger| {
257
- slog:: error!(
258
- logger,
259
- "unable to retrieve satoshi number: {}" ,
260
- e. to_string( )
261
- ) ;
262
- } ) ;
263
- continue ;
264
- }
265
- } ;
271
+ inscription. inscription_number = inscription_number;
266
272
ctx. try_log ( |logger| {
267
273
slog:: info!(
268
274
logger,
@@ -273,13 +279,13 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data(
273
279
traversal. ordinal_number
274
280
) ;
275
281
} ) ;
282
+ store_new_inscription (
283
+ & inscription,
284
+ & block. block_identifier ,
285
+ & rw_hord_db_conn,
286
+ & ctx,
287
+ ) ;
276
288
}
277
- store_new_inscription (
278
- & inscription,
279
- & block. block_identifier ,
280
- & rw_hord_db_conn,
281
- & ctx,
282
- ) ;
283
289
}
284
290
Storage :: Memory ( map) => {
285
291
let outpoint = inscription. satpoint_post_inscription
0 commit comments