Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Add HASH_SIZE guard
Browse files Browse the repository at this point in the history
  • Loading branch information
tuommaki committed Jan 11, 2024
1 parent 85ffaa2 commit 4add551
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/node/src/types/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ impl From<&[u8]> for Hash {

impl From<Hash> for Message {
fn from(value: Hash) -> Self {
// This function requires changes if HASH_SIZE changes. Add guard for it.
const _: [(); 0 - { HASH_SIZE != 32 } as usize] = [];

let x = &value.0;
Message(libsecp256k1::curve::Scalar([
u32::from_be_bytes([x[0], x[1], x[2], x[3]]),
Expand Down

0 comments on commit 4add551

Please sign in to comment.