@@ -232,6 +232,7 @@ pub fn retrieve_inscribed_satoshi_points_from_block(
232
232
}
233
233
} ;
234
234
if let Some ( inscriptions_db_conn) = inscriptions_db_conn {
235
+ // TODO: introduce scanning context
235
236
if let Some ( traversal) = find_inscription_with_id (
236
237
& inscription_data. inscription_id ,
237
238
& block. block_identifier . hash ,
@@ -485,10 +486,6 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data(
485
486
} ;
486
487
487
488
let outputs = new_tx. metadata . outputs . clone ( ) ;
488
- ctx. try_log ( |logger| {
489
- slog:: info!( logger, "=> {:?} / {:?}" , traversal, outputs) ;
490
- } ) ;
491
-
492
489
inscription. ordinal_offset = traversal. get_ordinal_coinbase_offset ( ) ;
493
490
inscription. ordinal_block_height = traversal. get_ordinal_coinbase_height ( ) ;
494
491
inscription. ordinal_number = traversal. ordinal_number ;
@@ -501,20 +498,28 @@ pub fn update_storage_and_augment_bitcoin_block_with_inscription_reveal_data(
501
498
traversal. output_index,
502
499
traversal. inscription_offset_intra_output
503
500
) ;
504
- inscription. inscription_output_value =
505
- new_tx. metadata . outputs [ traversal. output_index ] . value ;
506
- inscription. inscriber_address = {
507
- let script_pub_key =
508
- new_tx. metadata . outputs [ traversal. output_index ] . get_script_pubkey_hex ( ) ;
509
- match Script :: from_hex ( & script_pub_key) {
510
- Ok ( script) => match Address :: from_script ( & script, network) {
511
- Ok ( a) => Some ( a. to_string ( ) ) ,
501
+ if let Some ( output) = new_tx. metadata . outputs . get ( traversal. output_index ) {
502
+ inscription. inscription_output_value = output. value ;
503
+ inscription. inscriber_address = {
504
+ let script_pub_key = output. get_script_pubkey_hex ( ) ;
505
+ match Script :: from_hex ( & script_pub_key) {
506
+ Ok ( script) => match Address :: from_script ( & script, network) {
507
+ Ok ( a) => Some ( a. to_string ( ) ) ,
508
+ _ => None ,
509
+ } ,
512
510
_ => None ,
513
- } ,
514
- _ => None ,
515
- }
516
- } ;
517
-
511
+ }
512
+ } ;
513
+ } else {
514
+ ctx. try_log ( |logger| {
515
+ slog:: warn!(
516
+ logger,
517
+ "Database corrupted, skipping cursed inscription => {:?} / {:?}" ,
518
+ traversal,
519
+ outputs
520
+ ) ;
521
+ } ) ;
522
+ }
518
523
match storage {
519
524
Storage :: Sqlite ( rw_hord_db_conn) => {
520
525
if traversal. ordinal_number == 0 {
0 commit comments