mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 16:55:46 +00:00
Truncated Display impl for ExecutionBlockHash (#9108)
- #6689 The intention is to only modify the INFO logs that's emitted regularly to reduce the verbosity. But I understand that this change will affect other display in the logs too that uses the `ExecutionBlockHash` display. So would love some feedbacks about the change. Co-Authored-By: Tan Chee Keong <tanck@sigmaprime.io> Co-Authored-By: Mac L <mjladson@pm.me>
This commit is contained in:
@@ -18,6 +18,18 @@ impl fmt::Debug for ExecutionBlockHash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for ExecutionBlockHash {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
let hash = format!("{}", self.0);
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"{}…{}",
|
||||||
|
&hash[..6],
|
||||||
|
&hash[hash.len().saturating_sub(4)..]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ExecutionBlockHash {
|
impl ExecutionBlockHash {
|
||||||
pub fn zero() -> Self {
|
pub fn zero() -> Self {
|
||||||
Self(Hash256::zero())
|
Self(Hash256::zero())
|
||||||
@@ -102,12 +114,6 @@ impl std::str::FromStr for ExecutionBlockHash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for ExecutionBlockHash {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
write!(f, "{}", self.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<Hash256> for ExecutionBlockHash {
|
impl From<Hash256> for ExecutionBlockHash {
|
||||||
fn from(hash: Hash256) -> Self {
|
fn from(hash: Hash256) -> Self {
|
||||||
Self(hash)
|
Self(hash)
|
||||||
|
|||||||
Reference in New Issue
Block a user