Fix test failure

This commit is contained in:
Ben Carman 2020-06-11 13:41:56 -05:00
parent 5559475534
commit 137d63d4a4

View file

@ -529,20 +529,18 @@ case class ChainHandler(
if (currentHeight >= maxHeight) { if (currentHeight >= maxHeight) {
Future.successful(accum) Future.successful(accum)
} else { } else {
val batchStartHeight = if (currentHeight == 0) { val (batchStartHeight, prev) = if (currentHeight == 0) {
0 (0, Vector.empty)
} else { } else {
currentHeight + 1 (currentHeight + 1, Vector(highestHeaderOpt).flatten)
} }
val batchEndHeight = Math.min(maxHeight, currentHeight + batchSize) val batchEndHeight = Math.min(maxHeight, currentHeight + batchSize)
for { for {
headersToCalc <- blockHeaderDAO.getBetweenHeights(batchStartHeight, headersToCalc <- blockHeaderDAO.getBetweenHeights(batchStartHeight,
batchEndHeight) batchEndHeight)
sortedHeaders = headersToCalc.sortBy(_.height) sortedHeaders = headersToCalc.sortBy(_.height)
headersWithWork <- loop(sortedHeaders, headersWithWork <- loop(sortedHeaders, prev)
Vector(highestHeaderOpt).flatten)
next <- loop2(maxHeight, headersWithWork) next <- loop2(maxHeight, headersWithWork)
} yield next } yield next
} }