Skip to content

Commit

Permalink
fix: panic for too high block hash
Browse files Browse the repository at this point in the history
  • Loading branch information
irisdv committed Oct 17, 2024
1 parent da939da commit 1e1a8aa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utu_relay.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ pub mod UtuRelay {
let next_cpow = self.register_blocks_helper(height + 1, blocks, block_hash);
let target_threshold = block.compute_target_threshold();
// verifies pow spent
assert_lt!(block_hash.into(), target_threshold);
if block_hash.into() < target_threshold {
panic!("Block hash is higher than its target threshold.");
};

let pow = compute_pow_from_target(target_threshold);
let existing_block = self.blocks.read(height);
Expand Down

0 comments on commit 1e1a8aa

Please sign in to comment.