mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +00:00
impl from hash256 for ExecutionBlockHash (#7369)
ref: #7367 Implement `From<Hash256>` for `ExecutionBlockHash
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user