make messagehash to derive from Hash

This commit is contained in:
Ivan Folgueira Bande 2025-01-09 22:52:38 +01:00
parent 3b0015dda5
commit 566fae9dac
No known key found for this signature in database
GPG Key ID: 3C117481F89E24A7

View File

@ -4,11 +4,11 @@ use serde::{Deserialize, Deserializer, Serialize};
use std::convert::TryInto;
use std::fmt;
use std::fmt::Write;
use std::hash::{Hash, Hasher};
use std::hash::Hash;
use std::str::FromStr;
/// Waku message hash, hex encoded sha256 digest of the message
#[derive(Debug, Serialize, PartialEq, Eq, Clone)]
#[derive(Debug, Serialize, PartialEq, Eq, Clone, Hash)]
pub struct MessageHash([u8; 32]);
impl MessageHash {
@ -20,13 +20,6 @@ impl MessageHash {
}
}
impl Hash for MessageHash {
fn hash<H: Hasher>(&self, state: &mut H) {
// Use the inner array to contribute to the hash
self.0.hash(state);
}
}
impl FromStr for MessageHash {
type Err = String;