@@ -426,7 +426,8 @@ pub fn find_inscriptions_at_wached_outpoint(
426
426
. prepare ( "SELECT inscription_id, inscription_number, ordinal_number, offset FROM inscriptions WHERE outpoint_to_watch = ? ORDER BY offset ASC" )
427
427
. map_err ( |e| format ! ( "unable to query inscriptions table: {}" , e. to_string( ) ) ) ?;
428
428
let mut results = vec ! [ ] ;
429
- let mut rows = stmt. query ( args)
429
+ let mut rows = stmt
430
+ . query ( args)
430
431
. map_err ( |e| format ! ( "unable to query inscriptions table: {}" , e. to_string( ) ) ) ?;
431
432
while let Ok ( Some ( row) ) = rows. next ( ) {
432
433
let inscription_id: String = row. get ( 0 ) . unwrap ( ) ;
@@ -537,6 +538,7 @@ pub async fn fetch_and_cache_blocks_in_hord_db(
537
538
let compress_block_data_pool = ThreadPool :: new ( 16 ) ;
538
539
let ( block_compressed_tx, block_compressed_rx) = crossbeam_channel:: bounded ( 32 ) ;
539
540
541
+ // Thread pool #1: given a block height, retrieve the block hash
540
542
for block_cursor in start_block..=end_block {
541
543
let block_height = block_cursor. clone ( ) ;
542
544
let block_hash_tx = block_hash_tx. clone ( ) ;
@@ -549,6 +551,7 @@ pub async fn fetch_and_cache_blocks_in_hord_db(
549
551
} )
550
552
}
551
553
554
+ // Thread pool #2: given a block hash, retrieve the full block (verbosity max, including prevout)
552
555
let bitcoin_network = bitcoin_config. network . clone ( ) ;
553
556
let bitcoin_config = bitcoin_config. clone ( ) ;
554
557
let moved_ctx = ctx. clone ( ) ;
@@ -597,7 +600,7 @@ pub async fn fetch_and_cache_blocks_in_hord_db(
597
600
. expect ( "unable to spawn thread" ) ;
598
601
599
602
let mut blocks_stored = 0 ;
600
- let mut cursor = 1 + find_latest_compacted_block_known ( & rw_hord_db_conn ) as usize ;
603
+ let mut cursor = 1 + start_block as usize ;
601
604
let mut inbox = HashMap :: new ( ) ;
602
605
603
606
while let Ok ( Some ( ( block_height, compacted_block, raw_block) ) ) = block_compressed_rx. recv ( ) {
@@ -816,7 +819,7 @@ pub fn retrieve_satoshi_point_using_local_storage(
816
819
// )
817
820
// });
818
821
819
- if sats_in >= sats_out {
822
+ if sats_out < sats_in {
820
823
ordinal_offset = sats_out - ( sats_in - txin_value) ;
821
824
ordinal_block_number = block_height;
822
825
0 commit comments