Skip to content

Commit 670bde6

Browse files
author
Ludo Galabru
committed
fix: build warnings
1 parent dda0b03 commit 670bde6

File tree

3 files changed

+21
-11
lines changed
  • components

3 files changed

+21
-11
lines changed

components/chainhook-cli/src/cli/mod.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ use chainhook_event_observer::chainhooks::types::{
1414
};
1515
use chainhook_event_observer::hord::db::{
1616
delete_blocks_in_block_range_sqlite, delete_data_in_hord_db, fetch_and_cache_blocks_in_hord_db,
17-
find_block_at_block_height, find_block_at_block_height_sqlite,
18-
find_inscriptions_at_wached_outpoint, find_last_block_inserted,
17+
find_block_at_block_height, find_block_at_block_height_sqlite, find_last_block_inserted,
1918
find_watched_satpoint_for_inscription, initialize_hord_db, insert_entry_in_blocks,
2019
insert_entry_in_blocks_lazy_block, open_readonly_hord_db_conn,
2120
open_readonly_hord_db_conn_rocks_db, open_readwrite_hord_db_conn,
22-
open_readwrite_hord_db_conn_rocks_db, retrieve_satoshi_point_using_lazy_storage,
23-
CompactedBlock, LazyBlock,
21+
open_readwrite_hord_db_conn_rocks_db, retrieve_satoshi_point_using_lazy_storage, LazyBlock,
2422
};
2523
use chainhook_event_observer::hord::{
26-
new_traversals_cache, new_traversals_lazy_cache, retrieve_inscribed_satoshi_points_from_block,
24+
new_traversals_lazy_cache, retrieve_inscribed_satoshi_points_from_block,
2725
update_storage_and_augment_bitcoin_block_with_inscription_transfer_data, Storage,
2826
};
2927
use chainhook_event_observer::indexer;

components/chainhook-event-observer/src/hord/db/mod.rs

+16-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::{
2727
};
2828

2929
use super::{
30-
new_traversals_cache, new_traversals_lazy_cache,
30+
new_traversals_lazy_cache,
3131
ord::{height::Height, sat::Sat},
3232
update_hord_db_and_augment_bitcoin_block,
3333
};
@@ -570,9 +570,21 @@ pub fn find_lazy_block_at_block_height(
570570
retry: u8,
571571
blocks_db: &DB,
572572
) -> Option<LazyBlock> {
573-
match blocks_db.get(block_height.to_be_bytes()) {
574-
Ok(Some(res)) => Some(LazyBlock::new(res)),
575-
_ => None,
573+
let mut attempt = 0;
574+
// let mut read_options = rocksdb::ReadOptions::default();
575+
// read_options.fill_cache(true);
576+
// read_options.set_verify_checksums(false);
577+
loop {
578+
match blocks_db.get(block_height.to_be_bytes()) {
579+
Ok(Some(res)) => return Some(LazyBlock::new(res)),
580+
_ => {
581+
attempt += 1;
582+
std::thread::sleep(std::time::Duration::from_secs(1));
583+
if attempt > retry {
584+
return None;
585+
}
586+
}
587+
}
576588
}
577589
}
578590

components/chainhook-event-observer/src/observer/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::chainhooks::types::{
1010
ChainhookConfig, ChainhookFullSpecification, ChainhookSpecification,
1111
};
1212

13-
use crate::hord::new_traversals_cache;
13+
use crate::hord::new_traversals_lazy_cache;
1414
#[cfg(feature = "ordinals")]
1515
use crate::hord::{
1616
db::{open_readwrite_hord_db_conn, open_readwrite_hord_db_conn_rocks_db},
@@ -596,7 +596,7 @@ pub async fn start_observer_commands_handler(
596596
let mut chainhooks_lookup: HashMap<String, ApiKey> = HashMap::new();
597597
let networks = (&config.bitcoin_network, &config.stacks_network);
598598
let mut bitcoin_block_store: HashMap<BlockIdentifier, BitcoinBlockData> = HashMap::new();
599-
let traversals_cache = Arc::new(new_traversals_cache());
599+
let traversals_cache = Arc::new(new_traversals_lazy_cache());
600600

601601
loop {
602602
let command = match observer_commands_rx.recv() {

0 commit comments

Comments
 (0)