1
1
use crate :: config:: generator:: generate_config;
2
2
use crate :: config:: { Config , PredicatesApi } ;
3
- use crate :: scan:: bitcoin:: scan_bitcoin_chainstate_via_rpc_using_predicate;
4
3
use crate :: service:: Service ;
5
- use crate :: storage:: get_last_block_height_inserted;
6
4
7
- use chainhook_sdk:: chainhooks:: types:: ChainhookFullSpecification ;
8
- use chainhook_sdk:: hord:: db:: {
5
+ use crate :: db:: {
9
6
delete_data_in_hord_db, find_last_block_inserted, find_lazy_block_at_block_height,
10
7
find_watched_satpoint_for_inscription, initialize_hord_db, open_readonly_hord_db_conn,
11
8
open_readonly_hord_db_conn_rocks_db, open_readwrite_hord_db_conn,
12
9
open_readwrite_hord_db_conn_rocks_db, retrieve_satoshi_point_using_lazy_storage,
13
10
} ;
14
- use chainhook_sdk :: hord:: {
11
+ use crate :: hord:: {
15
12
new_traversals_lazy_cache, retrieve_inscribed_satoshi_points_from_block,
16
13
update_storage_and_augment_bitcoin_block_with_inscription_transfer_data, Storage ,
17
14
} ;
15
+ use chainhook_sdk:: chainhooks:: types:: ChainhookFullSpecification ;
18
16
use chainhook_sdk:: indexer;
19
17
use chainhook_sdk:: indexer:: bitcoin:: {
20
18
download_and_parse_block_with_retry, retrieve_block_hash_with_retry,
21
19
} ;
22
20
use chainhook_sdk:: observer:: BitcoinConfig ;
23
21
use chainhook_sdk:: utils:: Context ;
24
- use chainhook_types:: { BitcoinBlockData , BitcoinNetwork , BlockIdentifier , TransactionIdentifier } ;
22
+ use chainhook_types:: { BitcoinBlockData , BlockIdentifier , TransactionIdentifier } ;
25
23
use clap:: { Parser , Subcommand } ;
26
- use ctrlc;
27
24
use hiro_system_kit;
28
25
use std:: collections:: BTreeMap ;
29
26
use std:: io:: { BufReader , Read } ;
30
27
use std:: path:: PathBuf ;
31
28
use std:: process;
32
- use std:: sync:: mpsc:: Sender ;
33
29
use std:: sync:: Arc ;
34
30
35
31
#[ derive( Parser , Debug ) ]
@@ -153,26 +149,6 @@ enum HordDbCommand {
153
149
Check ( CheckDbCommand ) ,
154
150
}
155
151
156
- #[ derive( Subcommand , PartialEq , Clone , Debug ) ]
157
- enum StacksCommand {
158
- /// Db maintenance related commands
159
- #[ clap( subcommand) ]
160
- Db ( StacksDbCommand ) ,
161
- }
162
-
163
- #[ derive( Subcommand , PartialEq , Clone , Debug ) ]
164
- enum StacksDbCommand {
165
- /// Check integrity
166
- #[ clap( name = "check" , bin_name = "check" ) ]
167
- Check ( CheckDbCommand ) ,
168
- /// Update database using latest Stacks archive file
169
- #[ clap( name = "update" , bin_name = "update" ) ]
170
- Update ( UpdateDbCommand ) ,
171
- /// Retrieve a block from the Stacks db
172
- #[ clap( name = "get" , bin_name = "get" ) ]
173
- GetBlock ( GetBlockDbCommand ) ,
174
- }
175
-
176
152
#[ derive( Subcommand , PartialEq , Clone , Debug ) ]
177
153
enum ScanCommand {
178
154
/// Compute ordinal number of the 1st satoshi of the 1st input of a given transaction
@@ -307,30 +283,6 @@ struct CheckDbCommand {
307
283
pub config_path : Option < String > ,
308
284
}
309
285
310
- #[ derive( Parser , PartialEq , Clone , Debug ) ]
311
- struct UpdateDbCommand {
312
- /// Load config file path
313
- #[ clap( long = "config-path" ) ]
314
- pub config_path : Option < String > ,
315
- }
316
-
317
- #[ derive( Parser , PartialEq , Clone , Debug ) ]
318
- struct GetBlockDbCommand {
319
- /// Block index to retrieve
320
- #[ clap( long = "block-height" ) ]
321
- pub block_height : u64 ,
322
- /// Load config file path
323
- #[ clap( long = "config-path" ) ]
324
- pub config_path : Option < String > ,
325
- }
326
-
327
- #[ derive( Parser , PartialEq , Clone , Debug ) ]
328
- struct InitHordDbCommand {
329
- /// Load config file path
330
- #[ clap( long = "config-path" ) ]
331
- pub config_path : Option < String > ,
332
- }
333
-
334
286
pub fn main ( ) {
335
287
let logger = hiro_system_kit:: log:: setup_logger ( ) ;
336
288
let _guard = hiro_system_kit:: log:: setup_global_logger ( logger. clone ( ) ) ;
@@ -444,6 +396,7 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> {
444
396
}
445
397
None => {
446
398
let event_observer_config = config. get_event_observer_config ( ) ;
399
+ let hord_config = config. get_hord_config ( ) ;
447
400
let bitcoin_config = event_observer_config. get_bitcoin_config ( ) ;
448
401
let block =
449
402
fetch_and_standardize_block ( cmd. block_height , & bitcoin_config, & ctx)
@@ -453,7 +406,7 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> {
453
406
let _traversals = retrieve_inscribed_satoshi_points_from_block (
454
407
& block,
455
408
None ,
456
- event_observer_config . hord_config . as_ref ( ) . unwrap ( ) ,
409
+ & hord_config,
457
410
& traversals_cache,
458
411
& ctx,
459
412
) ;
@@ -621,13 +574,12 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> {
621
574
"Cleaning hord_db: {} blocks dropped" ,
622
575
cmd. end_block - cmd. start_block + 1
623
576
) ;
624
- }
625
- // HordDbCommand::Patch(_cmd) => {
626
- // unimplemented!()
627
- // }
628
- // HordDbCommand::Migrate(_cmd) => {
629
- // unimplemented!()
630
- // }
577
+ } // HordDbCommand::Patch(_cmd) => {
578
+ // unimplemented!()
579
+ // }
580
+ // HordDbCommand::Migrate(_cmd) => {
581
+ // unimplemented!()
582
+ // }
631
583
}
632
584
Ok ( ( ) )
633
585
}
0 commit comments