mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 12:58:31 +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:
@@ -374,7 +374,7 @@ pub fn spawn_notifier<T: BeaconChainTypes>(
|
||||
warn!(
|
||||
info = "chain not fully verified, \
|
||||
block and attestation production disabled until execution engine syncs",
|
||||
execution_block_hash = ?hash,
|
||||
execution_block_hash = ?hash,
|
||||
"Head is optimistic"
|
||||
);
|
||||
format!("{} (unverified)", hash)
|
||||
|
||||
@@ -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 {
|
||||
pub fn zero() -> Self {
|
||||
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 {
|
||||
fn from(hash: Hash256) -> Self {
|
||||
Self(hash)
|
||||
|
||||
Reference in New Issue
Block a user