Skip to content

Commit 819821f

Browse files
bsuiericAnastasiiaL
andcommitted
Update BlockFetcherState with suggestion from review
Co-authored-by: Anastasiia Pushkina <[email protected]>
1 parent f873b74 commit 819821f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockFetcherState.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,10 @@ case class BlockFetcherState(
130130
}
131131

132132
private def checkConsistencyWithReadyBlocks(headers: Seq[BlockHeader]): Boolean = {
133-
if (waitingHeaders.isEmpty) {
134-
(readyBlocks.lastOption.map(_.header), headers.headOption).mapN(_ isParentOf _).getOrElse(true)
135-
} else true
133+
(readyBlocks, headers) match {
134+
case (_ :+ last, head +: _) if waitingHeaders.isEmpty => last.header isParentOf head
135+
case _ => true
136+
}
136137
}
137138

138139
def validateNewBlockHashes(hashes: Seq[BlockHash]): Either[String, Seq[BlockHash]] =

0 commit comments

Comments
 (0)