Move the cryptographic hash to newly created pallas-crypto

This commit is contained in:
Nicolas Di Prima 2022-01-17 23:16:13 +00:00
parent cea75d6626
commit ad2e0d1bb3
No known key found for this signature in database
GPG key ID: CE351471B788435F
15 changed files with 309 additions and 71 deletions

View file

@ -29,8 +29,8 @@ impl DecodePayload for Content {
impl BlockLike for Content {
fn block_point(&self) -> Result<Point, Box<dyn std::error::Error>> {
let hash = crypto::hash_block_header(&self.0.header)?;
Ok(Point(self.0.header.header_body.slot, Vec::from(hash)))
let hash = crypto::hash_block_header(&self.0.header);
Ok(Point(self.0.header.header_body.slot, hash.to_vec()))
}
}

View file

@ -37,8 +37,8 @@ impl DecodePayload for Content {
impl BlockLike for Content {
fn block_point(&self) -> Result<Point, Box<dyn std::error::Error>> {
let hash = crypto::hash_block_header(&self.1)?;
Ok(Point(self.1.header_body.slot, Vec::from(hash)))
let hash = crypto::hash_block_header(&self.1);
Ok(Point(self.1.header_body.slot, hash.to_vec()))
}
}