@@ -35,7 +35,7 @@ use ordhook::scan::bitcoin::scan_bitcoin_chainstate_via_rpc_using_predicate;
35
35
use ordhook:: service:: observers:: initialize_observers_db;
36
36
use ordhook:: service:: { start_observer_forwarding, Service } ;
37
37
use ordhook:: utils:: bitcoind:: bitcoind_get_block_height;
38
- use ordhook:: { hex, initialize_db } ;
38
+ use ordhook:: { hex, initialize_databases } ;
39
39
use reqwest:: Client as HttpClient ;
40
40
use std:: collections:: HashSet ;
41
41
use std:: io:: { BufReader , Read } ;
@@ -586,7 +586,7 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
586
586
let mut total_inscriptions = 0 ;
587
587
let mut total_transfers = 0 ;
588
588
589
- let db_connections = initialize_db ( & config, ctx) ;
589
+ let db_connections = initialize_databases ( & config, ctx) ;
590
590
let inscriptions_db_conn = db_connections. ordhook ;
591
591
while let Some ( block_height) = block_range. pop_front ( ) {
592
592
let inscriptions =
@@ -704,16 +704,12 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
704
704
705
705
let config =
706
706
ConfigFile :: default ( cmd. regtest , cmd. testnet , cmd. mainnet , & cmd. config_path ) ?;
707
-
708
- initialize_db ( & config, ctx) ;
709
-
710
- let inscriptions_db_conn =
711
- open_readonly_ordhook_db_conn ( & config. expected_cache_path ( ) , ctx) ?;
707
+ let db_connections = initialize_databases ( & config, ctx) ;
712
708
713
709
let last_known_block =
714
- find_latest_inscription_block_height ( & inscriptions_db_conn , ctx) ?;
710
+ find_latest_inscription_block_height ( & db_connections . ordhook , ctx) ?;
715
711
if last_known_block. is_none ( ) {
716
- // Create DB
712
+ // Create rocksdb
717
713
open_ordhook_db_conn_rocks_db_loop (
718
714
true ,
719
715
& config. expected_cache_path ( ) ,
@@ -746,7 +742,6 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
746
742
} ;
747
743
748
744
let mut predicates = vec ! [ ] ;
749
-
750
745
for post_to in cmd. post_to . iter ( ) {
751
746
let predicate = build_predicate_from_cli (
752
747
& config,
@@ -788,7 +783,7 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
788
783
Command :: Db ( OrdhookDbCommand :: New ( cmd) ) => {
789
784
let config = ConfigFile :: default ( false , false , false , & cmd. config_path ) ?;
790
785
// Create DB
791
- initialize_db ( & config, ctx) ;
786
+ initialize_databases ( & config, ctx) ;
792
787
open_ordhook_db_conn_rocks_db_loop (
793
788
true ,
794
789
& config. expected_cache_path ( ) ,
@@ -799,7 +794,7 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
799
794
}
800
795
Command :: Db ( OrdhookDbCommand :: Sync ( cmd) ) => {
801
796
let config = ConfigFile :: default ( false , false , false , & cmd. config_path ) ?;
802
- initialize_db ( & config, ctx) ;
797
+ initialize_databases ( & config, ctx) ;
803
798
let service = Service :: new ( config, ctx. clone ( ) ) ;
804
799
service. update_state ( None ) . await ?;
805
800
}
0 commit comments