mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-24 06:57:51 +01:00
Fix test failure
This commit is contained in:
parent
5559475534
commit
137d63d4a4
1 changed files with 4 additions and 6 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue