Skip to content

Commit f29204c

Browse files
committed
fix: gracefully handle block hashes not present
1 parent 010d0b9 commit f29204c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,13 @@ async fn main() -> Result<(), MainError> {
406406

407407
let idx: NodeIndex = {
408408
let tree_locked = tree_clone.lock().await;
409-
*tree_locked
410-
.1
411-
.get(hash)
412-
.expect("hash should already be present")
409+
match tree_locked.1.get(hash) {
410+
Some(idx) => *idx,
411+
None => {
412+
error!("Block hash {} not (yet) present in tree for network: {}. Skipping identification...", hash.to_string(), network_clone.name);
413+
continue;
414+
}
415+
}
413416
};
414417

415418
let mut header_info = {

0 commit comments

Comments
 (0)