File tree 1 file changed +9
-3
lines changed
components/hord-cli/src/scan
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -75,8 +75,6 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate(
75
75
BlockHeights :: BlockRange ( start_block, end_block) . get_sorted_entries ( )
76
76
} ;
77
77
78
- // Are we dealing with an ordinals-based predicate?
79
- // If so, we could use the ordinal storage to provide a set of hints.
80
78
let mut inscriptions_db_conn = open_readonly_hord_db_conn ( & config. expected_cache_path ( ) , ctx) ?;
81
79
82
80
info ! (
@@ -96,6 +94,14 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate(
96
94
while let Some ( current_block_height) = block_heights_to_scan. pop_front ( ) {
97
95
number_of_blocks_scanned += 1 ;
98
96
97
+ // Re-initiate connection every 250 blocks (pessimistic) to avoid stale connections
98
+ let conn_updated = if number_of_blocks_scanned % 250 == 0 {
99
+ inscriptions_db_conn = open_readonly_hord_db_conn ( & config. expected_cache_path ( ) , ctx) ?;
100
+ true
101
+ } else {
102
+ false
103
+ } ;
104
+
99
105
if !get_any_entry_in_ordinal_activities ( & current_block_height, & inscriptions_db_conn, & ctx)
100
106
{
101
107
continue ;
@@ -143,7 +149,7 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate(
143
149
144
150
info ! (
145
151
ctx. expect_logger( ) ,
146
- "Processing block #{current_block_height} through {} predicate (inscriptions revealed: [{}])" ,
152
+ "Processing block #{current_block_height} through {} predicate (inscriptions revealed: [{}], db_conn updated: {conn_updated} )" ,
147
153
predicate_spec. uuid,
148
154
inscriptions_revealed. join( ", " )
149
155
) ;
You can’t perform that action at this time.
0 commit comments