impl from hash256 for ExecutionBlockHash (#7369)

ref: #7367


  Implement `From<Hash256>` for `ExecutionBlockHash
This commit is contained in:
ltitanb
2025-05-16 14:23:11 +01:00
committed by GitHub
parent b051a5d6cc
commit 1d27855db7

View File

@@ -112,3 +112,22 @@ impl fmt::Display for ExecutionBlockHash {
write!(f, "{}", self.0)
}
}
impl From<Hash256> for ExecutionBlockHash {
fn from(hash: Hash256) -> Self {
Self(hash)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_from_hash256() {
let hash = Hash256::random();
let ex_hash = ExecutionBlockHash::from(hash);
assert_eq!(ExecutionBlockHash(hash), ex_hash);
}
}