fix: build warnings

This commit is contained in:
Ludo Galabru
2023-05-10 17:12:05 -04:00
parent dda0b03ea3
commit 670bde6379
3 changed files with 21 additions and 11 deletions

View File

@@ -14,16 +14,14 @@ use chainhook_event_observer::chainhooks::types::{
};
use chainhook_event_observer::hord::db::{
delete_blocks_in_block_range_sqlite, delete_data_in_hord_db, fetch_and_cache_blocks_in_hord_db,
find_block_at_block_height, find_block_at_block_height_sqlite,
find_inscriptions_at_wached_outpoint, find_last_block_inserted,
find_block_at_block_height, find_block_at_block_height_sqlite, find_last_block_inserted,
find_watched_satpoint_for_inscription, initialize_hord_db, insert_entry_in_blocks,
insert_entry_in_blocks_lazy_block, open_readonly_hord_db_conn,
open_readonly_hord_db_conn_rocks_db, open_readwrite_hord_db_conn,
open_readwrite_hord_db_conn_rocks_db, retrieve_satoshi_point_using_lazy_storage,
CompactedBlock, LazyBlock,
open_readwrite_hord_db_conn_rocks_db, retrieve_satoshi_point_using_lazy_storage, LazyBlock,
};
use chainhook_event_observer::hord::{
new_traversals_cache, new_traversals_lazy_cache, retrieve_inscribed_satoshi_points_from_block,
new_traversals_lazy_cache, retrieve_inscribed_satoshi_points_from_block,
update_storage_and_augment_bitcoin_block_with_inscription_transfer_data, Storage,
};
use chainhook_event_observer::indexer;

View File

@@ -27,7 +27,7 @@ use crate::{
};
use super::{
new_traversals_cache, new_traversals_lazy_cache,
new_traversals_lazy_cache,
ord::{height::Height, sat::Sat},
update_hord_db_and_augment_bitcoin_block,
};
@@ -570,9 +570,21 @@ pub fn find_lazy_block_at_block_height(
retry: u8,
blocks_db: &DB,
) -> Option<LazyBlock> {
match blocks_db.get(block_height.to_be_bytes()) {
Ok(Some(res)) => Some(LazyBlock::new(res)),
_ => None,
let mut attempt = 0;
// let mut read_options = rocksdb::ReadOptions::default();
// read_options.fill_cache(true);
// read_options.set_verify_checksums(false);
loop {
match blocks_db.get(block_height.to_be_bytes()) {
Ok(Some(res)) => return Some(LazyBlock::new(res)),
_ => {
attempt += 1;
std::thread::sleep(std::time::Duration::from_secs(1));
if attempt > retry {
return None;
}
}
}
}
}

View File

@@ -10,7 +10,7 @@ use crate::chainhooks::types::{
ChainhookConfig, ChainhookFullSpecification, ChainhookSpecification,
};
use crate::hord::new_traversals_cache;
use crate::hord::new_traversals_lazy_cache;
#[cfg(feature = "ordinals")]
use crate::hord::{
db::{open_readwrite_hord_db_conn, open_readwrite_hord_db_conn_rocks_db},
@@ -596,7 +596,7 @@ pub async fn start_observer_commands_handler(
let mut chainhooks_lookup: HashMap<String, ApiKey> = HashMap::new();
let networks = (&config.bitcoin_network, &config.stacks_network);
let mut bitcoin_block_store: HashMap<BlockIdentifier, BitcoinBlockData> = HashMap::new();
let traversals_cache = Arc::new(new_traversals_cache());
let traversals_cache = Arc::new(new_traversals_lazy_cache());
loop {
let command = match observer_commands_rx.recv() {