Skip to content

Commit

Permalink
fix: handle non-spending transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludo Galabru committed May 4, 2023
1 parent 9431684 commit cb01eb5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions components/chainhook-event-observer/src/hord/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,13 @@ pub fn retrieve_satoshi_point_using_local_storage(
local_block_cache.clear();

hops += 1;
if hops as u64 > block_identifier.index {
return Err(format!(
"Unable to process transaction {}, manual investigation required",
transaction_identifier.hash
));
}

let block = match local_block_cache.get(&ordinal_block_number) {
Some(block) => block,
None => match find_block_at_block_height(ordinal_block_number, 3, &blocks_db) {
Expand Down Expand Up @@ -1205,6 +1212,13 @@ pub fn retrieve_satoshi_point_using_local_storage(
break;
}
}

if sats_in == 0 {
return Err(format!(
"Transaction {} is originating from a non spending transaction",
transaction_identifier.hash
));
}
}
}
}
Expand Down

0 comments on commit cb01eb5

Please sign in to comment.