Skip to content

Commit

Permalink
[ECIM-354] Apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-golebiewski committed Jun 22, 2021
1 parent 6b2d9d9 commit 8b6bc37
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
11 changes: 1 addition & 10 deletions src/main/scala/io/iohk/ethereum/forkid/ForkId.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,7 @@ object ForkId {
else None
}

(maybeDaoBlock.toList ++
config.forkBlockNumbers.productIterator.toList.flatMap {
case i: BigInt => Some(i)
case i: Option[_] =>
i.flatMap {
case n if n.isInstanceOf[BigInt] => Some(n.asInstanceOf[BigInt])
case n => None
}
case default => None
})
(maybeDaoBlock.toList ++ config.forkBlockNumbers.all)
.filterNot(v => v == 0 || v == noFork)
.distinct
.sorted
Expand Down
12 changes: 11 additions & 1 deletion src/main/scala/io/iohk/ethereum/utils/BlockchainConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,17 @@ case class ForkBlockNumbers(
ecip1097BlockNumber: BigInt,
ecip1049BlockNumber: Option[BigInt],
ecip1099BlockNumber: BigInt
)
) {
def all: List[BigInt] = this.productIterator.toList.flatMap {
case i: BigInt => Some(i)
case i: Option[_] =>
i.flatMap {
case n if n.isInstanceOf[BigInt] => Some(n.asInstanceOf[BigInt])
case n => None
}
case default => None
}
}

object BlockchainConfig {

Expand Down

0 comments on commit 8b6bc37

Please sign in to comment.