ForkCondition: some small refactors (#10712)

This commit is contained in:
Thomas Coratger
2024-09-05 09:17:29 -07:00
committed by GitHub
parent b0fddef46a
commit 1ec5678081
2 changed files with 5 additions and 4 deletions

View File

@ -522,10 +522,11 @@ impl ChainSpec {
ForkCondition::Timestamp(timestamp) => {
// to satisfy every timestamp ForkCondition, we find the last ForkCondition::Block
// if one exists, and include its block_num in the returned Head
if let Some(last_block_num) = self.last_block_fork_before_merge_or_timestamp() {
return Head { timestamp, number: last_block_num, ..Default::default() }
Head {
timestamp,
number: self.last_block_fork_before_merge_or_timestamp().unwrap_or_default(),
..Default::default()
}
Head { timestamp, ..Default::default() }
}
ForkCondition::TTD { total_difficulty, .. } => {
Head { total_difficulty, ..Default::default() }