Skip to content

Commit 8dd91bf

Browse files
author
Ludo Galabru
committed
fix: build errors
1 parent 2ab6b32 commit 8dd91bf

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -1083,4 +1083,5 @@ pub async fn fetch_and_standardize_block(
10831083
download_and_parse_block_with_retry(&block_hash, &bitcoin_config, &ctx).await?;
10841084

10851085
indexer::bitcoin::standardize_bitcoin_block(block_breakdown, &bitcoin_config.network, &ctx)
1086+
.map_err(|(e, _)| e)
10861087
}

components/chainhook-cli/src/scan/bitcoin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate(
111111
ctx,
112112
) {
113113
Ok(data) => data,
114-
Err(e) => {
114+
Err((e, _)) => {
115115
warn!(
116116
ctx.expect_logger(),
117117
"Unable to standardize block#{} {}: {}", cursor, block_hash, e

components/chainhook-sdk/src/hord/db/mod.rs

+18-4
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,26 @@ pub fn find_inscription_with_id(
492492
inscription_id: &str,
493493
block_hash: &str,
494494
inscriptions_db_conn: &Connection,
495-
_ctx: &Context,
495+
ctx: &Context,
496496
) -> Option<TraversalResult> {
497497
let args: &[&dyn ToSql] = &[&inscription_id.to_sql().unwrap()];
498-
let mut stmt = inscriptions_db_conn
498+
let mut stmt = loop {
499+
match inscriptions_db_conn
499500
.prepare("SELECT inscription_number, ordinal_number, block_hash, offset, outpoint_to_watch FROM inscriptions WHERE inscription_id = ?")
500-
.unwrap();
501+
{
502+
Ok(stmt) => break stmt,
503+
Err(e) => {
504+
ctx.try_log(|logger| {
505+
slog::warn!(
506+
logger,
507+
"unable to retrieve inscription with id: {}",
508+
e.to_string(),
509+
)
510+
});
511+
std::thread::sleep(std::time::Duration::from_secs(5));
512+
}
513+
}
514+
};
501515
let mut rows = stmt.query(args).unwrap();
502516
while let Ok(Some(row)) = rows.next() {
503517
let inscription_block_hash: String = row.get(2).unwrap();
@@ -828,7 +842,7 @@ pub async fn fetch_and_cache_blocks_in_hord_db(
828842
let mut new_block =
829843
match standardize_bitcoin_block(next_block, &bitcoin_network, &ctx) {
830844
Ok(block) => block,
831-
Err(e) => {
845+
Err((e, _)) => {
832846
ctx.try_log(|logger| {
833847
slog::error!(logger, "Unable to standardize bitcoin block: {e}",)
834848
});

0 commit comments

Comments
 (0)