@@ -23,13 +23,14 @@ use ordhook::core::protocol::inscription_parsing::parse_inscriptions_and_standar
23
23
use ordhook:: core:: protocol:: satoshi_numbering:: compute_satoshi_number;
24
24
use ordhook:: db:: {
25
25
delete_data_in_ordhook_db, find_all_inscription_transfers, find_all_inscriptions_in_block,
26
- find_all_transfers_in_block, find_inscription_with_id , find_last_block_inserted ,
27
- find_latest_inscription_block_height, find_lazy_block_at_block_height ,
26
+ find_all_transfers_in_block, find_block_bytes_at_block_height , find_inscription_with_id ,
27
+ find_last_block_inserted , find_latest_inscription_block_height, find_missing_blocks ,
28
28
get_default_ordhook_db_file_path, initialize_ordhook_db, open_ordhook_db_conn_rocks_db_loop,
29
29
open_readonly_ordhook_db_conn, open_readonly_ordhook_db_conn_rocks_db,
30
- open_readwrite_ordhook_db_conn,
30
+ open_readwrite_ordhook_db_conn, BlockBytesCursor ,
31
31
} ;
32
32
use ordhook:: download:: download_ordinals_dataset_if_required;
33
+ use ordhook:: hex;
33
34
use ordhook:: scan:: bitcoin:: scan_bitcoin_chainstate_via_rpc_using_predicate;
34
35
use ordhook:: service:: { start_observer_forwarding, Service } ;
35
36
use reqwest:: Client as HttpClient ;
@@ -577,7 +578,7 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
577
578
let mut total_transfers_in_block = 0 ;
578
579
579
580
for ( _, inscription) in inscriptions. iter ( ) {
580
- println ! ( "Inscription {} revealed at block #{} (inscription_number {}, ordinal_number {})" , inscription. get_inscription_id( ) , block_height, inscription. inscription_number, inscription. ordinal_number) ;
581
+ println ! ( "Inscription {} revealed at block #{} (inscription_number {}, ordinal_number {})" , inscription. get_inscription_id( ) , block_height, inscription. inscription_number. jubilee , inscription. ordinal_number) ;
581
582
if let Some ( transfers) = locations. remove ( & inscription. get_inscription_id ( ) )
582
583
{
583
584
for t in transfers. iter ( ) . skip ( 1 ) {
@@ -639,7 +640,7 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
639
640
"Inscription {} revealed at block #{} (inscription_number {}, ordinal_number {})" ,
640
641
inscription. get_inscription_id( ) ,
641
642
block_height,
642
- inscription. inscription_number,
643
+ inscription. inscription_number. jubilee ,
643
644
inscription. ordinal_number
644
645
) ;
645
646
let transfers = find_all_inscription_transfers (
@@ -668,15 +669,19 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
668
669
. await ?;
669
670
let transaction_identifier = TransactionIdentifier :: new ( & cmd. transaction_id ) ;
670
671
let cache = new_traversals_lazy_cache ( 100 ) ;
671
- let res = compute_satoshi_number (
672
+ let ( res, mut back_trace ) = compute_satoshi_number (
672
673
& config. get_ordhook_config ( ) . db_path ,
673
674
& block. block_identifier ,
674
675
& transaction_identifier,
675
676
0 ,
676
- 0 ,
677
677
& Arc :: new ( cache) ,
678
+ true ,
678
679
ctx,
679
680
) ?;
681
+ back_trace. reverse ( ) ;
682
+ for ( block_height, tx) in back_trace. iter ( ) {
683
+ println ! ( "{}\t {}" , block_height, hex:: encode( tx) ) ;
684
+ }
680
685
println ! ( "{:?}" , res) ;
681
686
}
682
687
Command :: Service ( subcmd) => match subcmd {
@@ -793,9 +798,10 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
793
798
ctx,
794
799
) ;
795
800
for i in cmd. get_blocks ( ) . into_iter ( ) {
796
- let block =
797
- find_lazy_block_at_block_height ( i as u32 , 10 , false , & blocks_db, ctx)
801
+ let block_bytes =
802
+ find_block_bytes_at_block_height ( i as u32 , 10 , & blocks_db, ctx)
798
803
. expect ( "unable to retrieve block {i}" ) ;
804
+ let block = BlockBytesCursor :: new ( & block_bytes) ;
799
805
info ! ( ctx. expect_logger( ) , "--------------------" ) ;
800
806
info ! ( ctx. expect_logger( ) , "Block: {i}" ) ;
801
807
for tx in block. iter_tx ( ) {
@@ -861,18 +867,9 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
861
867
{
862
868
let blocks_db =
863
869
open_readonly_ordhook_db_conn_rocks_db ( & config. expected_cache_path ( ) , ctx) ?;
864
- let tip = find_last_block_inserted ( & blocks_db) as u64 ;
870
+ let tip = find_last_block_inserted ( & blocks_db) ;
865
871
println ! ( "Tip: {}" , tip) ;
866
-
867
- let mut missing_blocks = vec ! [ ] ;
868
- for i in cmd. start_block ..=cmd. end_block {
869
- if find_lazy_block_at_block_height ( i as u32 , 0 , false , & blocks_db, ctx)
870
- . is_none ( )
871
- {
872
- println ! ( "Missing block #{i}" ) ;
873
- missing_blocks. push ( i) ;
874
- }
875
- }
872
+ let missing_blocks = find_missing_blocks ( & blocks_db, 1 , tip, ctx) ;
876
873
println ! ( "{:?}" , missing_blocks) ;
877
874
}
878
875
}
0 commit comments