mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(node-builder): display the hardfork info in new line (#7185)
Signed-off-by: jsvisa <delweng@gmail.com> Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -461,7 +461,7 @@ where
|
|||||||
|
|
||||||
let genesis_hash = init_genesis(provider_factory.clone())?;
|
let genesis_hash = init_genesis(provider_factory.clone())?;
|
||||||
|
|
||||||
info!(target: "reth::cli", "{}",config.chain.display_hardforks());
|
info!(target: "reth::cli", "\n{}", config.chain.display_hardforks());
|
||||||
|
|
||||||
let consensus = config.consensus();
|
let consensus = config.consensus();
|
||||||
|
|
||||||
|
|||||||
@ -1454,7 +1454,7 @@ impl Display for DisplayFork {
|
|||||||
write!(f, "{:32} @{}", name_with_eip, at)?;
|
write!(f, "{:32} @{}", name_with_eip, at)?;
|
||||||
}
|
}
|
||||||
ForkCondition::TTD { fork_block, total_difficulty } => {
|
ForkCondition::TTD { fork_block, total_difficulty } => {
|
||||||
writeln!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"{:32} @{} ({})",
|
"{:32} @{} ({})",
|
||||||
name_with_eip,
|
name_with_eip,
|
||||||
@ -1502,7 +1502,6 @@ impl Display for DisplayFork {
|
|||||||
// - GrayGlacier @15050000
|
// - GrayGlacier @15050000
|
||||||
// Merge hard forks:
|
// Merge hard forks:
|
||||||
// - Paris @58750000000000000000000 (network is known to be merged)
|
// - Paris @58750000000000000000000 (network is known to be merged)
|
||||||
//
|
|
||||||
// Post-merge hard forks (timestamp based):
|
// Post-merge hard forks (timestamp based):
|
||||||
// - Shanghai @1681338455
|
// - Shanghai @1681338455
|
||||||
/// ```
|
/// ```
|
||||||
@ -1518,23 +1517,36 @@ pub struct DisplayHardforks {
|
|||||||
|
|
||||||
impl Display for DisplayHardforks {
|
impl Display for DisplayHardforks {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
writeln!(f, "Pre-merge hard forks (block based):")?;
|
fn format(
|
||||||
for fork in self.pre_merge.iter() {
|
header: &str,
|
||||||
writeln!(f, "- {fork}")?;
|
forks: &[DisplayFork],
|
||||||
|
next_is_empty: bool,
|
||||||
|
f: &mut Formatter<'_>,
|
||||||
|
) -> std::fmt::Result {
|
||||||
|
writeln!(f, "{}:", header)?;
|
||||||
|
let mut iter = forks.iter().peekable();
|
||||||
|
while let Some(fork) = iter.next() {
|
||||||
|
write!(f, "- {}", fork)?;
|
||||||
|
if !next_is_empty || iter.peek().is_some() {
|
||||||
|
writeln!(f)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
format(
|
||||||
|
"Pre-merge hard forks (block based)",
|
||||||
|
&self.pre_merge,
|
||||||
|
self.with_merge.is_empty(),
|
||||||
|
f,
|
||||||
|
)?;
|
||||||
|
|
||||||
if !self.with_merge.is_empty() {
|
if !self.with_merge.is_empty() {
|
||||||
writeln!(f, "Merge hard forks:")?;
|
format("Merge hard forks", &self.with_merge, self.post_merge.is_empty(), f)?;
|
||||||
for fork in self.with_merge.iter() {
|
|
||||||
writeln!(f, "- {fork}")?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.post_merge.is_empty() {
|
if !self.post_merge.is_empty() {
|
||||||
writeln!(f, "Post-merge hard forks (timestamp based):")?;
|
format("Post-merge hard forks (timestamp based)", &self.post_merge, true, f)?;
|
||||||
for fork in self.post_merge.iter() {
|
|
||||||
writeln!(f, "- {fork}")?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -1655,11 +1667,9 @@ mod tests {
|
|||||||
- GrayGlacier @15050000
|
- GrayGlacier @15050000
|
||||||
Merge hard forks:
|
Merge hard forks:
|
||||||
- Paris @58750000000000000000000 (network is known to be merged)
|
- Paris @58750000000000000000000 (network is known to be merged)
|
||||||
|
|
||||||
Post-merge hard forks (timestamp based):
|
Post-merge hard forks (timestamp based):
|
||||||
- Shanghai @1681338455
|
- Shanghai @1681338455
|
||||||
- Cancun @1710338135
|
- Cancun @1710338135"
|
||||||
"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1674,8 +1684,7 @@ Post-merge hard forks (timestamp based):
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
spec.display_hardforks().to_string(),
|
spec.display_hardforks().to_string(),
|
||||||
"Pre-merge hard forks (block based):
|
"Pre-merge hard forks (block based):
|
||||||
- Frontier @0
|
- Frontier @0"
|
||||||
"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user