Skip to content

Commit

Permalink
fix: build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalabru committed Jun 26, 2023
1 parent 2ab6b32 commit 8dd91bf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions components/chainhook-cli/src/cli/mod.rs
Expand Up @@ -1083,4 +1083,5 @@ pub async fn fetch_and_standardize_block(
download_and_parse_block_with_retry(&block_hash, &bitcoin_config, &ctx).await?;

indexer::bitcoin::standardize_bitcoin_block(block_breakdown, &bitcoin_config.network, &ctx)
.map_err(|(e, _)| e)
}
2 changes: 1 addition & 1 deletion components/chainhook-cli/src/scan/bitcoin.rs
Expand Up @@ -111,7 +111,7 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate(
ctx,
) {
Ok(data) => data,
Err(e) => {
Err((e, _)) => {
warn!(
ctx.expect_logger(),
"Unable to standardize block#{} {}: {}", cursor, block_hash, e
Expand Down
22 changes: 18 additions & 4 deletions components/chainhook-sdk/src/hord/db/mod.rs
Expand Up @@ -492,12 +492,26 @@ pub fn find_inscription_with_id(
inscription_id: &str,
block_hash: &str,
inscriptions_db_conn: &Connection,
_ctx: &Context,
ctx: &Context,
) -> Option<TraversalResult> {
let args: &[&dyn ToSql] = &[&inscription_id.to_sql().unwrap()];
let mut stmt = inscriptions_db_conn
let mut stmt = loop {
match inscriptions_db_conn
.prepare("SELECT inscription_number, ordinal_number, block_hash, offset, outpoint_to_watch FROM inscriptions WHERE inscription_id = ?")
.unwrap();
{
Ok(stmt) => break stmt,
Err(e) => {
ctx.try_log(|logger| {
slog::warn!(
logger,
"unable to retrieve inscription with id: {}",
e.to_string(),
)
});
std::thread::sleep(std::time::Duration::from_secs(5));
}
}
};
let mut rows = stmt.query(args).unwrap();
while let Ok(Some(row)) = rows.next() {
let inscription_block_hash: String = row.get(2).unwrap();
Expand Down Expand Up @@ -828,7 +842,7 @@ pub async fn fetch_and_cache_blocks_in_hord_db(
let mut new_block =
match standardize_bitcoin_block(next_block, &bitcoin_network, &ctx) {
Ok(block) => block,
Err(e) => {
Err((e, _)) => {
ctx.try_log(|logger| {
slog::error!(logger, "Unable to standardize bitcoin block: {e}",)
});
Expand Down

0 comments on commit 8dd91bf

Please sign in to comment.