Skip to content

Commit

Permalink
make messagehash to derive from Hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivansete-status committed Jan 9, 2025
1 parent 3b0015d commit 566fae9
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions waku-bindings/src/general/messagehash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;

Expand Down

0 comments on commit 566fae9

Please sign in to comment.